Cleanup: strip trailing space from interface files
This commit is contained in:
@@ -85,7 +85,7 @@
|
||||
|
||||
/**
|
||||
* a full doc with API notes can be found in 'blender/doc/guides/interface_API.txt'
|
||||
*
|
||||
*
|
||||
* `uiBlahBlah()` external function.
|
||||
* `ui_blah_blah()` internal function.
|
||||
*/
|
||||
@@ -290,7 +290,7 @@ void ui_block_bounds_calc(uiBlock *block)
|
||||
{
|
||||
uiBut *bt;
|
||||
int xof;
|
||||
|
||||
|
||||
if (BLI_listbase_is_empty(&block->buttons)) {
|
||||
if (block->panel) {
|
||||
block->rect.xmin = 0.0; block->rect.xmax = block->panel->sizex;
|
||||
@@ -298,13 +298,13 @@ void ui_block_bounds_calc(uiBlock *block)
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
BLI_rctf_init_minmax(&block->rect);
|
||||
|
||||
for (bt = block->buttons.first; bt; bt = bt->next) {
|
||||
BLI_rctf_union(&block->rect, &bt->rect);
|
||||
}
|
||||
|
||||
|
||||
block->rect.xmin -= block->bounds;
|
||||
block->rect.ymin -= block->bounds;
|
||||
block->rect.xmax += block->bounds;
|
||||
@@ -313,7 +313,7 @@ void ui_block_bounds_calc(uiBlock *block)
|
||||
|
||||
block->rect.xmax = block->rect.xmin + max_ff(BLI_rctf_size_x(&block->rect), block->minbounds);
|
||||
|
||||
/* hardcoded exception... but that one is annoying with larger safety */
|
||||
/* hardcoded exception... but that one is annoying with larger safety */
|
||||
bt = block->buttons.first;
|
||||
if (bt && STREQLEN(bt->str, "ERROR", 5)) xof = 10;
|
||||
else xof = 40;
|
||||
@@ -329,7 +329,7 @@ static void ui_block_bounds_calc_centered(wmWindow *window, uiBlock *block)
|
||||
int xmax, ymax;
|
||||
int startx, starty;
|
||||
int width, height;
|
||||
|
||||
|
||||
/* note: this is used for the splash where window bounds event has not been
|
||||
* updated by ghost, get the window bounds from ghost directly */
|
||||
|
||||
@@ -337,18 +337,18 @@ static void ui_block_bounds_calc_centered(wmWindow *window, uiBlock *block)
|
||||
ymax = WM_window_pixels_y(window);
|
||||
|
||||
ui_block_bounds_calc(block);
|
||||
|
||||
|
||||
width = BLI_rctf_size_x(&block->rect);
|
||||
height = BLI_rctf_size_y(&block->rect);
|
||||
|
||||
|
||||
startx = (xmax * 0.5f) - (width * 0.5f);
|
||||
starty = (ymax * 0.5f) - (height * 0.5f);
|
||||
|
||||
|
||||
ui_block_translate(block, startx - block->rect.xmin, starty - block->rect.ymin);
|
||||
|
||||
|
||||
/* now recompute bounds and safety */
|
||||
ui_block_bounds_calc(block);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ui_block_bounds_calc_centered_pie(uiBlock *block)
|
||||
@@ -378,7 +378,7 @@ static void ui_block_bounds_calc_popup(
|
||||
|
||||
/* compute mouse position with user defined offset */
|
||||
ui_block_bounds_calc(block);
|
||||
|
||||
|
||||
xmax = WM_window_pixels_x(window);
|
||||
ymax = WM_window_pixels_y(window);
|
||||
|
||||
@@ -436,7 +436,7 @@ void UI_block_bounds_set_normal(uiBlock *block, int addval)
|
||||
{
|
||||
if (block == NULL)
|
||||
return;
|
||||
|
||||
|
||||
block->bounds = addval;
|
||||
block->bounds_type = UI_BLOCK_BOUNDS;
|
||||
}
|
||||
@@ -511,12 +511,12 @@ static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines, int das
|
||||
rcti rect;
|
||||
|
||||
if (line->from == NULL || line->to == NULL) return;
|
||||
|
||||
|
||||
rect.xmin = BLI_rctf_cent_x(&line->from->rect);
|
||||
rect.ymin = BLI_rctf_cent_y(&line->from->rect);
|
||||
rect.xmax = BLI_rctf_cent_x(&line->to->rect);
|
||||
rect.ymax = BLI_rctf_cent_y(&line->to->rect);
|
||||
|
||||
|
||||
if (dashInactiveLines)
|
||||
UI_ThemeColor(TH_GRID);
|
||||
else if (line->flag & UI_SELECT)
|
||||
@@ -629,12 +629,12 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut
|
||||
{
|
||||
uiLinkLine *line;
|
||||
uiBut *but;
|
||||
|
||||
|
||||
/* if active button is UI_BTYPE_LINK */
|
||||
if (newbut->type == UI_BTYPE_LINK && newbut->link) {
|
||||
|
||||
|
||||
SWAP(uiLink *, oldbut->link, newbut->link);
|
||||
|
||||
|
||||
for (line = oldbut->link->lines.first; line; line = line->next) {
|
||||
if (line->to == newbut)
|
||||
line->to = oldbut;
|
||||
@@ -642,7 +642,7 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut
|
||||
line->from = oldbut;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* check all other button links */
|
||||
for (but = block->buttons.first; but; but = but->next) {
|
||||
if (but != newbut && but->type == UI_BTYPE_LINK && but->link) {
|
||||
@@ -811,7 +811,7 @@ bool UI_but_active_only(const bContext *C, ARegion *ar, uiBlock *block, uiBut *b
|
||||
uiBlock *oldblock;
|
||||
uiBut *oldbut;
|
||||
bool activate = false, found = false, isactive = false;
|
||||
|
||||
|
||||
oldblock = block->oldblock;
|
||||
if (!oldblock) {
|
||||
activate = true;
|
||||
@@ -834,7 +834,7 @@ bool UI_but_active_only(const bContext *C, ARegion *ar, uiBlock *block, uiBut *b
|
||||
ui_but_free(C, but);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1038,27 +1038,27 @@ static bool ui_but_event_property_operator_string(
|
||||
"WM_OT_context_cycle_array",
|
||||
"WM_OT_context_menu_enum",
|
||||
NULL
|
||||
};
|
||||
};
|
||||
const size_t num_ops = sizeof(ctx_toggle_opnames) / sizeof(const char *);
|
||||
|
||||
|
||||
bool found = false;
|
||||
|
||||
|
||||
/* this version is only for finding hotkeys for properties (which get set via context using operators) */
|
||||
if (but->rnaprop) {
|
||||
/* to avoid massive slowdowns on property panels, for now, we only check the
|
||||
/* to avoid massive slowdowns on property panels, for now, we only check the
|
||||
* hotkeys for Editor / Scene settings...
|
||||
*
|
||||
* TODO: userpref settings?
|
||||
*/
|
||||
// TODO: value (for enum stuff)?
|
||||
char *data_path = NULL;
|
||||
|
||||
|
||||
if (but->rnapoin.id.data) {
|
||||
ID *id = but->rnapoin.id.data;
|
||||
|
||||
|
||||
if (GS(id->name) == ID_SCR) {
|
||||
/* screen/editor property
|
||||
* NOTE: in most cases, there is actually no info for backwards tracing
|
||||
/* screen/editor property
|
||||
* NOTE: in most cases, there is actually no info for backwards tracing
|
||||
* how to get back to ID from the editor data we may be dealing with
|
||||
*/
|
||||
if (RNA_struct_is_a(but->rnapoin.type, &RNA_Space)) {
|
||||
@@ -1079,7 +1079,7 @@ static bool ui_but_event_property_operator_string(
|
||||
}
|
||||
else if (GS(id->name) == ID_SCE) {
|
||||
if (RNA_struct_is_a(but->rnapoin.type, &RNA_ToolSettings)) {
|
||||
/* toolsettings property
|
||||
/* toolsettings property
|
||||
* NOTE: toolsettings is usually accessed directly (i.e. not through scene)
|
||||
*/
|
||||
data_path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop);
|
||||
@@ -1087,7 +1087,7 @@ static bool ui_but_event_property_operator_string(
|
||||
else {
|
||||
/* scene property */
|
||||
char *path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop);
|
||||
|
||||
|
||||
if (path) {
|
||||
data_path = BLI_sprintfN("scene.%s", path);
|
||||
MEM_freeN(path);
|
||||
@@ -1103,23 +1103,23 @@ static bool ui_but_event_property_operator_string(
|
||||
else {
|
||||
//puts("other id");
|
||||
}
|
||||
|
||||
|
||||
//printf("prop shortcut: '%s' (%s)\n", RNA_property_identifier(but->rnaprop), data_path);
|
||||
}
|
||||
|
||||
|
||||
/* we have a datapath! */
|
||||
if (data_path) {
|
||||
size_t i;
|
||||
|
||||
|
||||
/* create a property to host the "datapath" property we're sending to the operators */
|
||||
IDProperty *prop_path;
|
||||
IDProperty *prop_path_value;
|
||||
|
||||
|
||||
IDPropertyTemplate val = {0};
|
||||
prop_path = IDP_New(IDP_GROUP, &val, __func__);
|
||||
prop_path_value = IDP_NewString(data_path, "data_path", strlen(data_path) + 1);
|
||||
IDP_AddToGroup(prop_path, prop_path_value);
|
||||
|
||||
|
||||
/* check each until one works... */
|
||||
for (i = 0; (i < num_ops) && (ctx_toggle_opnames[i]); i++) {
|
||||
if (WM_key_event_operator_string(
|
||||
@@ -1130,14 +1130,14 @@ static bool ui_but_event_property_operator_string(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* cleanup */
|
||||
IDP_FreeProperty(prop_path);
|
||||
MEM_freeN(prop_path);
|
||||
MEM_freeN(data_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
@@ -1294,7 +1294,7 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2], int r_x
|
||||
if (block->flag & UI_BLOCK_LOOP) {
|
||||
ui_menu_block_set_keymaps(C, block);
|
||||
}
|
||||
|
||||
|
||||
/* after keymaps! */
|
||||
switch (block->bounds_type) {
|
||||
case UI_BLOCK_BOUNDS_NONE:
|
||||
@@ -1342,12 +1342,12 @@ void ui_fontscale(short *points, float aspect)
|
||||
{
|
||||
if (aspect < 0.9f || aspect > 1.1f) {
|
||||
float pointsf = *points;
|
||||
|
||||
|
||||
/* for some reason scaling fonts goes too fast compared to widget size */
|
||||
/* XXX not true anymore? (ton) */
|
||||
//aspect = sqrt(aspect);
|
||||
pointsf /= aspect;
|
||||
|
||||
|
||||
if (aspect > 1.0f)
|
||||
*points = ceilf(pointsf);
|
||||
else
|
||||
@@ -1373,7 +1373,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
|
||||
uiBut *but;
|
||||
rcti rect;
|
||||
int multisample_enabled;
|
||||
|
||||
|
||||
/* get menu region or area region */
|
||||
ar = CTX_wm_menu(C);
|
||||
if (!ar)
|
||||
@@ -1389,16 +1389,16 @@ void UI_block_draw(const bContext *C, uiBlock *block)
|
||||
|
||||
/* we set this only once */
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
/* scale fonts */
|
||||
ui_fontscale(&style.paneltitle.points, block->aspect);
|
||||
ui_fontscale(&style.grouplabel.points, block->aspect);
|
||||
ui_fontscale(&style.widgetlabel.points, block->aspect);
|
||||
ui_fontscale(&style.widget.points, block->aspect);
|
||||
|
||||
|
||||
/* scale block min/max to rect */
|
||||
ui_but_to_pixelrect(&rect, ar, block, NULL);
|
||||
|
||||
|
||||
/* pixel space for AA widgets */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
@@ -1407,7 +1407,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
|
||||
glLoadIdentity();
|
||||
|
||||
wmOrtho2_region_pixelspace(ar);
|
||||
|
||||
|
||||
/* back */
|
||||
if (block->flag & UI_BLOCK_RADIAL)
|
||||
ui_draw_pie_center(block);
|
||||
@@ -1420,14 +1420,14 @@ void UI_block_draw(const bContext *C, uiBlock *block)
|
||||
for (but = block->buttons.first; but; but = but->next) {
|
||||
if (!(but->flag & (UI_HIDDEN | UI_SCROLLED))) {
|
||||
ui_but_to_pixelrect(&rect, ar, block, but);
|
||||
|
||||
|
||||
/* XXX: figure out why invalid coordinates happen when closing render window */
|
||||
/* and material preview is redrawn in main window (temp fix for bug #23848) */
|
||||
if (rect.xmin < rect.xmax && rect.ymin < rect.ymax)
|
||||
ui_draw_but(C, ar, &style, but, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* restore matrix */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
@@ -1436,7 +1436,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
|
||||
|
||||
if (multisample_enabled)
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
|
||||
|
||||
ui_draw_links(block);
|
||||
}
|
||||
|
||||
@@ -1524,7 +1524,7 @@ static void ui_but_update_select_flag(uiBut *but, double *value)
|
||||
static uiBut *ui_linkline_find_inlink(uiBlock *block, void *poin)
|
||||
{
|
||||
uiBut *but;
|
||||
|
||||
|
||||
but = block->buttons.first;
|
||||
while (but) {
|
||||
if (but->type == UI_BTYPE_INLINK) {
|
||||
@@ -1538,7 +1538,7 @@ static uiBut *ui_linkline_find_inlink(uiBlock *block, void *poin)
|
||||
static void ui_linkline_add(ListBase *listb, uiBut *but, uiBut *bt, short deactive)
|
||||
{
|
||||
uiLinkLine *line;
|
||||
|
||||
|
||||
line = MEM_callocN(sizeof(uiLinkLine), "linkline");
|
||||
BLI_addtail(listb, line);
|
||||
line->from = but;
|
||||
@@ -1557,12 +1557,12 @@ void UI_block_links_compose(uiBlock *block)
|
||||
uiLink *link;
|
||||
void ***ppoin;
|
||||
int a;
|
||||
|
||||
|
||||
but = block->buttons.first;
|
||||
while (but) {
|
||||
if (but->type == UI_BTYPE_LINK) {
|
||||
link = but->link;
|
||||
|
||||
|
||||
/* for all pointers in the array */
|
||||
if (link) {
|
||||
if (link->ppoin) {
|
||||
@@ -1620,14 +1620,14 @@ void ui_linkline_remove(uiLinkLine *line, uiBut *but)
|
||||
{
|
||||
uiLink *link;
|
||||
int a, b;
|
||||
|
||||
|
||||
BLI_remlink(&but->link->lines, line);
|
||||
|
||||
link = line->from->link;
|
||||
|
||||
/* are there more pointers allowed? */
|
||||
if (link->ppoin) {
|
||||
|
||||
|
||||
if (*(link->totlink) == 1) {
|
||||
*(link->totlink) = 0;
|
||||
MEM_freeN(*(link->ppoin));
|
||||
@@ -1753,10 +1753,10 @@ bool ui_but_is_float(const uiBut *but)
|
||||
{
|
||||
if (but->pointype == UI_BUT_POIN_FLOAT && but->poin)
|
||||
return true;
|
||||
|
||||
|
||||
if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1787,7 +1787,7 @@ bool ui_but_is_unit(const uiBut *but)
|
||||
if (ui_but_is_unit_radians_ex(unit, unit_type))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
|
||||
/* for now disable time unit conversion */
|
||||
if (unit_type == PROP_UNIT_TIME)
|
||||
return false;
|
||||
@@ -1969,7 +1969,7 @@ void ui_but_value_set(uiBut *but, double value)
|
||||
if (fval >= -0.00001f && fval <= 0.00001f) fval = 0.0f; /* prevent negative zero */
|
||||
value = fval;
|
||||
}
|
||||
|
||||
|
||||
/* then set value with possible edit override */
|
||||
if (but->editval)
|
||||
value = *but->editval = value;
|
||||
@@ -2098,11 +2098,11 @@ void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
|
||||
UnitSettings *unit = but->block->unit;
|
||||
int unit_type = UI_but_unit_type_get(but);
|
||||
char *orig_str;
|
||||
|
||||
|
||||
orig_str = BLI_strdup(str);
|
||||
|
||||
|
||||
bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
|
||||
|
||||
|
||||
MEM_freeN(orig_str);
|
||||
}
|
||||
}
|
||||
@@ -2448,7 +2448,7 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
|
||||
else {
|
||||
ptr = but->rnasearchpoin;
|
||||
prop = but->rnasearchprop;
|
||||
|
||||
|
||||
if (prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr))
|
||||
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr);
|
||||
|
||||
@@ -2739,7 +2739,7 @@ void UI_block_free(const bContext *C, uiBlock *block)
|
||||
|
||||
BLI_freelistN(&block->saferct);
|
||||
BLI_freelistN(&block->color_pickers.list);
|
||||
|
||||
|
||||
MEM_freeN(block);
|
||||
}
|
||||
|
||||
@@ -2747,7 +2747,7 @@ void UI_block_free(const bContext *C, uiBlock *block)
|
||||
void UI_blocklist_free(const bContext *C, ListBase *lb)
|
||||
{
|
||||
uiBlock *block;
|
||||
|
||||
|
||||
while ((block = BLI_pophead(lb))) {
|
||||
UI_block_free(C, block);
|
||||
}
|
||||
@@ -2759,7 +2759,7 @@ void UI_blocklist_free_inactive(const bContext *C, ListBase *lb)
|
||||
|
||||
for (block = lb->first; block; block = nextblock) {
|
||||
nextblock = block->next;
|
||||
|
||||
|
||||
if (!block->handle) {
|
||||
if (!block->active) {
|
||||
BLI_remlink(lb, block);
|
||||
@@ -2871,9 +2871,9 @@ void ui_but_update_ex(uiBut *but, const bool validate)
|
||||
/* if something changed in the button */
|
||||
double value = UI_BUT_VALUE_UNSET;
|
||||
// float okwidth; // UNUSED
|
||||
|
||||
|
||||
ui_but_update_select_flag(but, &value);
|
||||
|
||||
|
||||
/* only update soft range while not editing */
|
||||
if (!(but->editval || but->editstr || but->editvec)) {
|
||||
if ((but->rnaprop != NULL) ||
|
||||
@@ -2902,7 +2902,7 @@ void ui_but_update_ex(uiBut *but, const bool validate)
|
||||
but->hardmin <= but->hardmax);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UI_BTYPE_ICON_TOGGLE:
|
||||
case UI_BTYPE_ICON_TOGGLE_N:
|
||||
if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
|
||||
@@ -2910,16 +2910,16 @@ void ui_but_update_ex(uiBut *but, const bool validate)
|
||||
else but->iconadd = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
/* quiet warnings for unhandled types */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* safety is 4 to enable small number buttons (like 'users') */
|
||||
// okwidth = -4 + (BLI_rcti_size_x(&but->rect)); // UNUSED
|
||||
|
||||
|
||||
/* name: */
|
||||
switch (but->type) {
|
||||
|
||||
@@ -3007,7 +3007,7 @@ void ui_but_update_ex(uiBut *but, const bool validate)
|
||||
else {
|
||||
BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case UI_BTYPE_TEXT:
|
||||
@@ -3019,7 +3019,7 @@ void ui_but_update_ex(uiBut *but, const bool validate)
|
||||
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, str);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UI_BTYPE_KEY_EVENT:
|
||||
{
|
||||
const char *str;
|
||||
@@ -3066,13 +3066,13 @@ void ui_but_update_ex(uiBut *but, const bool validate)
|
||||
default:
|
||||
BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* if we are doing text editing, this will override the drawstr */
|
||||
if (but->editstr)
|
||||
but->drawstr[0] = '\0';
|
||||
|
||||
|
||||
/* text clipping moved to widget drawing code itself */
|
||||
}
|
||||
|
||||
@@ -3155,7 +3155,7 @@ static uiBut *ui_def_but(
|
||||
int slen;
|
||||
|
||||
BLI_assert(width >= 0 && height >= 0);
|
||||
|
||||
|
||||
/* we could do some more error checks here */
|
||||
if ((type & BUTTYPE) == UI_BTYPE_LABEL) {
|
||||
BLI_assert((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f)) == false);
|
||||
@@ -3210,7 +3210,7 @@ static uiBut *ui_def_but(
|
||||
but->funcN = block->funcN;
|
||||
if (block->func_argN)
|
||||
but->func_argN = MEM_dupallocN(block->func_argN);
|
||||
|
||||
|
||||
but->pos = -1; /* cursor invisible */
|
||||
|
||||
if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { /* add a space to name */
|
||||
@@ -3263,7 +3263,7 @@ static uiBut *ui_def_but(
|
||||
}
|
||||
|
||||
BLI_addtail(&block->buttons, but);
|
||||
|
||||
|
||||
if (block->curlayout)
|
||||
ui_layout_add_but(block->curlayout, but);
|
||||
|
||||
@@ -3552,7 +3552,7 @@ static uiBut *ui_def_but_rna(
|
||||
if (icon) {
|
||||
ui_def_but_icon(but, icon, UI_HAS_ICON);
|
||||
}
|
||||
|
||||
|
||||
if ((type == UI_BTYPE_MENU) && (but->dt == UI_EMBOSS_PULLDOWN)) {
|
||||
but->flag |= UI_BUT_ICON_SUBMENU;
|
||||
}
|
||||
@@ -3629,7 +3629,7 @@ uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, in
|
||||
uiBut *but = ui_def_but(block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip);
|
||||
|
||||
ui_but_update(but);
|
||||
|
||||
|
||||
return but;
|
||||
}
|
||||
|
||||
@@ -3671,7 +3671,7 @@ struct AutoComplete {
|
||||
AutoComplete *UI_autocomplete_begin(const char *startname, size_t maxlen)
|
||||
{
|
||||
AutoComplete *autocpl;
|
||||
|
||||
|
||||
autocpl = MEM_callocN(sizeof(AutoComplete), "AutoComplete");
|
||||
autocpl->maxlen = maxlen;
|
||||
autocpl->matches = 0;
|
||||
@@ -3712,7 +3712,7 @@ void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name)
|
||||
}
|
||||
|
||||
int UI_autocomplete_end(AutoComplete *autocpl, char *autoname)
|
||||
{
|
||||
{
|
||||
int match = AUTOCOMPLETE_NO_MATCH;
|
||||
if (autocpl->truncate[0]) {
|
||||
if (autocpl->matches == 1) {
|
||||
@@ -3970,7 +3970,7 @@ uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int o
|
||||
uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_find(opname, 0);
|
||||
if (str && str[0] == '\0')
|
||||
if (str && str[0] == '\0')
|
||||
return uiDefIconButO_ptr(block, type, ot, opcontext, icon, x, y, width, height, tip);
|
||||
return uiDefIconTextButO_ptr(block, type, ot, opcontext, icon, str, x, y, width, height, tip);
|
||||
}
|
||||
@@ -3980,9 +3980,9 @@ uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcon
|
||||
void UI_but_link_set(uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to)
|
||||
{
|
||||
uiLink *link;
|
||||
|
||||
|
||||
link = but->link = MEM_callocN(sizeof(uiLink), "new uilink");
|
||||
|
||||
|
||||
link->poin = poin;
|
||||
link->ppoin = ppoin;
|
||||
link->totlink = tot;
|
||||
@@ -3996,11 +3996,11 @@ int UI_blocklist_min_y_get(ListBase *lb)
|
||||
{
|
||||
uiBlock *block;
|
||||
int min = 0;
|
||||
|
||||
|
||||
for (block = lb->first; block; block = block->next)
|
||||
if (block == lb->first || block->rect.ymin < min)
|
||||
min = block->rect.ymin;
|
||||
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
@@ -4019,7 +4019,7 @@ void UI_block_order_flip(uiBlock *block)
|
||||
return;
|
||||
else if (block->flag & UI_BLOCK_NO_FLIP)
|
||||
return;
|
||||
|
||||
|
||||
for (but = block->buttons.first; but; but = but->next) {
|
||||
if (but->drawflag & UI_BUT_ALIGN) return;
|
||||
if (but->rect.ymin < miny) miny = but->rect.ymin;
|
||||
@@ -4168,8 +4168,8 @@ void UI_but_unit_type_set(uiBut *but, const int unit_type)
|
||||
int UI_but_unit_type_get(const uiBut *but)
|
||||
{
|
||||
int ownUnit = (int)but->unit_type;
|
||||
|
||||
/* own unit define always takes precedence over RNA provided, allowing for overriding
|
||||
|
||||
/* own unit define always takes precedence over RNA provided, allowing for overriding
|
||||
* default value provided in RNA in a few special cases (i.e. Active Keyframe in Graph Edit)
|
||||
*/
|
||||
/* XXX: this doesn't allow clearing unit completely, though the same could be said for icons */
|
||||
@@ -4331,7 +4331,7 @@ uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int ic
|
||||
uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
|
||||
|
||||
|
||||
/* XXX temp, old menu calls pass on icon arrow, which is now UI_BUT_ICON_SUBMENU flag */
|
||||
if (icon != ICON_RIGHTARROW_THIN) {
|
||||
ui_def_but_icon(but, icon, 0);
|
||||
@@ -4342,7 +4342,7 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
|
||||
|
||||
but->block_create_func = func;
|
||||
ui_but_update(but);
|
||||
|
||||
|
||||
return but;
|
||||
}
|
||||
|
||||
@@ -4350,14 +4350,14 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
|
||||
uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x, int y, short width, short height, const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, retval, "", x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
|
||||
|
||||
|
||||
ui_def_but_icon(but, icon, UI_HAS_ICON);
|
||||
|
||||
but->drawflag |= UI_BUT_ICON_LEFT;
|
||||
|
||||
|
||||
but->block_create_func = func;
|
||||
ui_but_update(but);
|
||||
|
||||
|
||||
return but;
|
||||
}
|
||||
|
||||
@@ -4384,13 +4384,13 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, in
|
||||
uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but(block, UI_BTYPE_SEARCH_MENU, retval, "", x, y, width, height, arg, 0.0, maxlen, a1, a2, tip);
|
||||
|
||||
|
||||
ui_def_but_icon(but, icon, UI_HAS_ICON);
|
||||
|
||||
but->drawflag |= UI_BUT_ICON_LEFT | UI_BUT_TEXT_LEFT;
|
||||
|
||||
|
||||
ui_but_update(but);
|
||||
|
||||
|
||||
return but;
|
||||
}
|
||||
|
||||
@@ -4414,7 +4414,7 @@ void UI_but_func_search_set(
|
||||
but->search_create_func = search_create_func;
|
||||
but->search_func = search_func;
|
||||
but->search_arg = arg;
|
||||
|
||||
|
||||
if (bfunc) {
|
||||
#ifdef DEBUG
|
||||
if (but->func) {
|
||||
@@ -4424,7 +4424,7 @@ void UI_but_func_search_set(
|
||||
#endif
|
||||
UI_but_func_set(but, bfunc, arg, active);
|
||||
}
|
||||
|
||||
|
||||
/* search buttons show red-alert if item doesn't exist, not for menus */
|
||||
if (0 == (but->block->flag & UI_BLOCK_LOOP)) {
|
||||
/* skip empty buttons, not all buttons need input, we only show invalid */
|
||||
@@ -4522,14 +4522,14 @@ uiBut *uiDefSearchButO_ptr(
|
||||
void UI_but_focus_on_enter_event(wmWindow *win, uiBut *but)
|
||||
{
|
||||
wmEvent event;
|
||||
|
||||
|
||||
wm_event_init_from_window(win, &event);
|
||||
|
||||
event.type = EVT_BUT_OPEN;
|
||||
event.val = KM_PRESS;
|
||||
event.customdata = but;
|
||||
event.customdatafree = false;
|
||||
|
||||
|
||||
wm_event_add(win, &event);
|
||||
}
|
||||
|
||||
@@ -4653,7 +4653,7 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
|
||||
PointerRNA *ptr = NULL;
|
||||
PropertyRNA *prop = NULL;
|
||||
int value = 0;
|
||||
|
||||
|
||||
/* get the enum property... */
|
||||
if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
|
||||
/* enum property */
|
||||
@@ -4664,8 +4664,8 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
|
||||
else if (but->optype) {
|
||||
PointerRNA *opptr = UI_but_operator_ptr_get(but);
|
||||
wmOperatorType *ot = but->optype;
|
||||
|
||||
/* if the default property of the operator is enum and it is set,
|
||||
|
||||
/* if the default property of the operator is enum and it is set,
|
||||
* fetch the tooltip of the selected value so that "Snap" and "Mirror"
|
||||
* operator menus in the Anim Editors will show tooltips for the different
|
||||
* operations instead of the meaningless generic operator tooltip
|
||||
@@ -4678,12 +4678,12 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* get strings from matching enum item */
|
||||
if (ptr && prop) {
|
||||
if (!item) {
|
||||
int i;
|
||||
|
||||
|
||||
RNA_property_enum_items_gettexted(C, ptr, prop, &items, &totitems, &free_items);
|
||||
for (i = 0, item = items; i < totitems; i++, item++) {
|
||||
if (item->identifier[0] && item->value == value)
|
||||
|
||||
Reference in New Issue
Block a user