Code cleanup: removed some unused UI button types

* CHARTAB: not needed anymore with improved copy/paste support and text input.
* IDPOIN: replaced by SEARCH_MENU.
* ICONROW/ICONTEXTROW: replaced by RNA enums.
* NUMABS: can use min/max limits instead.
* BUT_TOGDUAL, TOG3, TOGR, SLI: not used in 2.5 interface.
This commit is contained in:
Brecht Van Lommel 2013-06-09 18:05:50 +00:00
parent 13b3b425f8
commit 860fce4eb9
12 changed files with 80 additions and 671 deletions

@ -19,26 +19,22 @@ Contents
4. API for uiButton
4.1 UiDefBut
1. BUT
2. TOG or TOGN or TOGR
2. TOG or TOGN
TOG|BIT|<nr>
3. TOG3|BIT|<nr>
4. ROW
5. SLI or NUMSLI or HSVSLI
6. NUM
7. TEX
8. LABEL
9 SEPR
10. MENU
11. COL
3. ROW
4. NUMSLI or HSVSLI
5. NUM
6. TEX
7. LABEL
8 SEPR
9. MENU
10. COL
4.2 Icon buttons
12. ICONROW
13. ICONTEXTROW
4.3 pulldown menus / block buttons
14. BLOCK
4.4 specials
15. KEYEVT
16. LINK and INLINK
17. IDPOIN
4.5 uiButton control fuctions
@ -289,55 +285,49 @@ type:
Activation button. (like "Render")
Passing on a pointer is not needed
2. TOG or TOGN or TOGR
2. TOG or TOGN
Toggle button (like "Lock")
The pointer value is set either at 0 or 1
If pressed, it calls the optional function with arguments provided.
Type TOGN: works negative, when pressed it sets at 0
Type TOGR: is part of a row, redraws automatically all buttons with same *poin
"|BIT|<nr>"
When added to type, it works on a single bit <nr> (lowest order bit: nr = '0')
3. TOG3|BIT|<nr>
A toggle with 3 values!
Can be only used for short *poin.
In the third toggle setting, the bit <nr> of *( poin+1) is set.
4. ROW
3. ROW
Button that's part of a row.
in "min" you set a row-id number, in "max" the value you want *poin to be
assigned when you press the button. Always pass on these values as floats.
When this button is pressed, it sets the "max" value to *poin, and redraws
all buttons with the same row-id number.
5. SLI or NUMSLI or HSVSLI
Slider, number-slider or hsv-slider button.
4. NUMSLI or HSVSLI
Number-slider or hsv-slider button.
"min" and "max" are to clamp the value to.
If you want a button type "Col" to be updated, make 'a1' equal to 'retval'
from the COL button.
6. NUM
5. NUM
Number button
Set the clamping values 'min' and 'max' always as float.
For UiDefButF, set a 'step' in 'a1', in 1/100's. The step value is the increment or
decrement when you click once on the right or left side of a button.
The optional button function is additionally called for each change of the *poin value.
7. TEX
6. TEX
Text string button.
Pointertype is standard a char. Value 'max' is length of string (pass as float).
When button is left with ESC, it doesn't put the 'retval' at the queue.
8. LABEL
7. LABEL
Label button.
Only displays text.
If 'min' is set at 1.0, the text is printed in white.
9 SEPR
8 SEPR
A separator line, typically used within pulldown menus.
10. MENU
9. MENU
Menu button.
The syntax of the string in *name defines the menu items:
- %t means the previous text becomes the title
@ -346,7 +336,7 @@ type:
without returnvalues, the first item gets value 0 (incl. title!)
Example: "Do something %t| turn left %2| turn right %1| nothing %0"
11. COLOR
10. COLOR
A special button that only visualizes a RGB value
In 'retval' you can put a code, which is used to identify for sliders if it needs
redraws while using the sliders. Check button '5'.
@ -371,19 +361,6 @@ uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *s
Same again, but now with an icon and string as button name.
Two special icon buttons are available in Blender:
12. ICONROW
(uiDefIconBut)
This button pops up a vertical menu with a row of icons to choose from.
'max' = amount of icons. The icons are supposed to be ordered in a sequence
It writes in *poin which item in the menu was choosen (starting with 0).
13. ICONTEXTROW
(uiDefIconTextBut)
Same as previous, but with the texts next to it.
-----------4.3 pulldown menus / block buttons
@ -465,37 +442,6 @@ uiDefIconBut(block, INLINK, 0, ICON_INLINK, x1, y1, w, h, void *poin, short from
17. IDPOIN
void uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, int retval, char *str,
short x1, short y1, short x2, short y2, void *idpp, char *tip)
The ID struct is a generic part in structs like Object, Material, Mesh, etc.
Most linking options in Blender happens using ID's. (Mesh -> Material).
This special button in Blender visualizes an ID pointer with its name. Typing in
a new name, changes the pointer. For most ID types in Blender functions have been
written already, needed by this button, to check validity of names, and assign the pointer.
(BTW: the 'void *idpp' has to be a pointer to the ID pointer!)
Example function that can be put in 'func':
void test_scriptpoin_but(char *name, ID **idpp)
{
ID *id;
id= G.main->text.first;
while(id) {
if( strcmp(name, id->name+2)==0 ) {
*idpp= id;
return;
}
id= id->next;
}
*idpp= 0;
}
------------- 4.5 uiButton control fuctions

@ -96,7 +96,6 @@ extern void BKE_undo_step(struct bContext *C, int step);
extern void BKE_undo_name(struct bContext *C, const char *name);
extern int BKE_undo_valid(const char *name);
extern void BKE_reset_undo(void);
extern char *BKE_undo_menu_string(void);
extern void BKE_undo_number(struct bContext *C, int nr);
extern const char *BKE_undo_get_name(int nr, int *active);
extern int BKE_undo_save_file(const char *filename);

@ -792,25 +792,6 @@ const char *BKE_undo_get_name(int nr, int *active)
return NULL;
}
char *BKE_undo_menu_string(void)
{
UndoElem *uel;
DynStr *ds = BLI_dynstr_new();
char *menu;
BLI_dynstr_append(ds, "Global Undo History %t");
for (uel = undobase.first; uel; uel = uel->next) {
BLI_dynstr_append(ds, "|");
BLI_dynstr_append(ds, uel->name);
}
menu = BLI_dynstr_get_cstring(ds);
BLI_dynstr_free(ds);
return menu;
}
/* saves .blend using undo buffer, returns 1 == success */
int BKE_undo_save_file(const char *filename)
{

@ -210,20 +210,14 @@ typedef enum {
BUT = (1 << 9),
ROW = (2 << 9),
TOG = (3 << 9),
SLI = (4 << 9),
NUM = (5 << 9),
TEX = (6 << 9),
TOG3 = (7 << 9),
TOGR = (8 << 9),
TOGN = (9 << 9),
LABEL = (10 << 9),
MENU = (11 << 9), /* Dropdown list, actually! */
ICONROW = (12 << 9),
ICONTOG = (13 << 9),
NUMSLI = (14 << 9),
COLOR = (15 << 9),
IDPOIN = (16 << 9),
/* HSVSLI = (17 << 9), */ /* UNUSED */
SCROLL = (18 << 9),
BLOCK = (19 << 9),
BUTM = (20 << 9),
@ -231,18 +225,13 @@ typedef enum {
LINK = (22 << 9),
INLINK = (23 << 9),
KEYEVT = (24 << 9),
ICONTEXTROW = (25 << 9),
HSVCUBE = (26 << 9),
PULLDOWN = (27 << 9), /* Menu, actually! */
ROUNDBOX = (28 << 9),
CHARTAB = (29 << 9),
BUT_COLORBAND = (30 << 9),
BUT_NORMAL = (31 << 9),
BUT_CURVE = (32 << 9),
BUT_TOGDUAL = (33 << 9),
ICONTOGN = (34 << 9),
/* FTPREVIEW = (35 << 9), */ /* UNUSED */
NUMABS = (36 << 9),
TOGBUT = (37 << 9),
OPTION = (38 << 9),
OPTIONN = (39 << 9),
@ -560,7 +549,6 @@ void uiButGetStrInfo(struct bContext *C, uiBut *but, ...);
/* Special Buttons
*
* Buttons with a more specific purpose:
* - IDPoinBut: for creating buttons that work on a pointer to an ID block.
* - MenuBut: buttons that popup a menu (in headers usually).
* - PulldownBut: like MenuBut, but creating a uiBlock (for compatibility).
* - BlockBut: buttons that popup a block with more buttons.
@ -582,12 +570,6 @@ void uiButGetStrInfo(struct bContext *C, uiBut *but, ...);
#define UI_ID_PREVIEWS 2048
#define UI_ID_FULL (UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL)
typedef void (*uiIDPoinFuncFP)(struct bContext *C, const char *str, struct ID **idpp);
typedef void (*uiIDPoinFunc)(struct bContext *C, struct ID *id, int event);
uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, const char *str,
int x, int y, short width, short height, void *idpp, const char *tip);
int uiIconFromID(struct ID *id);
uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);

@ -1140,9 +1140,6 @@ int ui_is_but_push_ex(uiBut *but, double *value)
break;
case TOGBUT:
case TOG:
case TOGR:
case TOG3:
case BUT_TOGDUAL:
case ICONTOG:
case OPTION:
UI_GET_BUT_VALUE_INIT(but, *value);
@ -1420,7 +1417,7 @@ bool ui_is_but_float(uiBut *but)
bool ui_is_but_bool(uiBut *but)
{
if (ELEM5(but->type, TOG, TOGN, TOGR, ICONTOG, ICONTOGN))
if (ELEM4(but->type, TOG, TOGN, ICONTOG, ICONTOGN))
return true;
if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_BOOLEAN)
@ -1620,8 +1617,6 @@ int ui_get_but_string_max_length(uiBut *but)
{
if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK))
return but->hardmax;
else if (but->type == IDPOIN)
return MAX_ID_NAME - 2;
else
return UI_MAX_DRAW_STR;
}
@ -1716,7 +1711,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
*/
void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision)
{
if (but->rnaprop && ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (but->rnaprop && ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
PropertyType type;
const char *buf = NULL;
int buf_len;
@ -1753,18 +1748,6 @@ void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int
MEM_freeN((void *)buf);
}
}
else if (but->type == IDPOIN) {
/* ID pointer */
if (but->idpoin_idpp) { /* Can be NULL for ID properties by python */
ID *id = *(but->idpoin_idpp);
if (id) {
BLI_strncpy(str, id->name + 2, maxlen);
return;
}
}
str[0] = '\0';
return;
}
else if (but->type == TEX) {
/* string */
BLI_strncpy(str, but->poin, maxlen);
@ -1865,7 +1848,7 @@ bool ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
bool ui_set_but_string(bContext *C, uiBut *but, const char *str)
{
if (but->rnaprop && ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (but->rnaprop && ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (RNA_property_editable(&but->rnapoin, but->rnaprop)) {
PropertyType type;
@ -1910,11 +1893,6 @@ bool ui_set_but_string(bContext *C, uiBut *but, const char *str)
}
}
}
else if (but->type == IDPOIN) {
/* ID pointer */
but->idpoin_func(C, str, but->idpoin_idpp);
return true;
}
else if (but->type == TEX) {
/* string */
if (ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax);
@ -1944,7 +1922,6 @@ bool ui_set_but_string(bContext *C, uiBut *but, const char *str)
}
if (!ui_is_but_float(but)) value = (int)floor(value + 0.5);
if (but->type == NUMABS) value = fabs(value);
/* not that we use hard limits here */
if (value < (double)but->hardmin) value = but->hardmin;
@ -2285,7 +2262,6 @@ void ui_check_but(uiBut *but)
/* test for min and max, icon sliders, etc */
switch (but->type) {
case NUM:
case SLI:
case SCROLL:
case NUMSLI:
UI_GET_BUT_VALUE_INIT(but, value);
@ -2293,15 +2269,6 @@ void ui_check_but(uiBut *but)
else if (value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
break;
case NUMABS:
{
double value_abs;
UI_GET_BUT_VALUE_INIT(but, value);
value_abs = fabs(value);
if (value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
else if (value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
break;
}
case ICONTOG:
case ICONTOGN:
if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
@ -2310,20 +2277,6 @@ void ui_check_but(uiBut *but)
}
break;
case ICONROW:
if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
UI_GET_BUT_VALUE_INIT(but, value);
but->iconadd = (int)value - (int)(but->hardmin);
}
break;
case ICONTEXTROW:
if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
UI_GET_BUT_VALUE_INIT(but, value);
but->iconadd = (int)value - (int)(but->hardmin);
}
break;
/* quiet warnings for unhandled types */
default:
break;
@ -2337,7 +2290,6 @@ void ui_check_but(uiBut *but)
switch (but->type) {
case MENU:
case ICONTEXTROW:
if (BLI_rctf_size_x(&but->rect) > 24.0f) {
UI_GET_BUT_VALUE_INIT(but, value);
@ -2347,7 +2299,6 @@ void ui_check_but(uiBut *but)
case NUM:
case NUMSLI:
case NUMABS:
UI_GET_BUT_VALUE_INIT(but, value);
@ -2394,7 +2345,6 @@ void ui_check_but(uiBut *but)
break;
case IDPOIN:
case TEX:
case SEARCH_MENU:
case SEARCH_MENU_UNLINK:
@ -2444,14 +2394,6 @@ void ui_check_but(uiBut *but)
break;
case BUT_TOGDUAL:
/* trying to get the dual-icon to left of text... not very nice */
if (but->str[0]) {
BLI_strncpy(but->drawstr, " ", UI_MAX_DRAW_STR);
BLI_strncpy(but->drawstr + 2, but->str, UI_MAX_DRAW_STR - 2);
}
break;
case HSVCUBE:
case HSVCIRCLE:
break;
@ -2771,7 +2713,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->pos = -1; /* cursor invisible */
if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* add a space to name */
if (ELEM(but->type, NUM, NUMSLI)) { /* add a space to name */
/* slen remains unchanged from previous assignment, ensure this stays true */
if (slen > 0 && slen < UI_MAX_NAME_STR - 2) {
if (but->str[slen - 1] != ' ') {
@ -2782,13 +2724,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
}
if ((block->flag & UI_BLOCK_LOOP) ||
ELEM9(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR, SEARCH_MENU_UNLINK))
ELEM8(but->type, MENU, TEX, LABEL, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR, SEARCH_MENU_UNLINK))
{
but->flag |= (UI_TEXT_LEFT | UI_ICON_LEFT);
}
else if (but->type == BUT_TOGDUAL) {
but->flag |= UI_ICON_LEFT;
}
but->flag |= (block->flag & UI_BUT_ALIGN);
@ -3164,26 +3103,6 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname)
MEM_freeN(autocpl);
}
/* autocomplete callback for ID buttons */
static void autocomplete_id(bContext *C, char *str, void *arg_v)
{
int blocktype = (intptr_t)arg_v;
ListBase *listb = which_libbase(CTX_data_main(C), blocktype);
if (listb == NULL) return;
/* search if str matches the beginning of an ID struct */
if (str[0]) {
AutoComplete *autocpl = autocomplete_begin(str, MAX_ID_NAME - 2);
ID *id;
for (id = listb->first; id; id = id->next)
autocomplete_do_name(autocpl, id->name + 2);
autocomplete_end(autocpl, str);
}
}
static void ui_check_but_and_iconize(uiBut *but, int icon)
{
if (icon) {
@ -3675,19 +3594,6 @@ void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg)
but->autofunc_arg = arg;
}
uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, const char *str, int x, int y, short width, short height, void *idpp, const char *tip)
{
uiBut *but = ui_def_but(block, IDPOIN, retval, str, x, y, width, height, NULL, 0.0, 0.0, 0.0, 0.0, tip);
but->idpoin_func = func;
but->idpoin_idpp = (ID **) idpp;
ui_check_but(but);
if (blocktype)
uiButSetCompleteFunc(but, autocomplete_id, (void *)(intptr_t)blocktype);
return but;
}
uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip)
{
uiBut *but = ui_def_but(block, BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);

@ -321,7 +321,7 @@ static uiBut *ui_but_last(uiBlock *block)
static bool ui_is_a_warp_but(uiBut *but)
{
if (U.uiflag & USER_CONTINUOUS_MOUSE) {
if (ELEM7(but->type, NUM, NUMSLI, NUMABS, HSVCIRCLE, TRACKPREVIEW, HSVCUBE, BUT_CURVE)) {
if (ELEM6(but->type, NUM, NUMSLI, HSVCIRCLE, TRACKPREVIEW, HSVCUBE, BUT_CURVE)) {
return true;
}
}
@ -431,7 +431,7 @@ static void ui_apply_undo(uiBut *but)
/* define which string to use for undo */
if (ELEM(but->type, LINK, INLINK)) str = "Add button link";
else if (ELEM(but->type, MENU, ICONTEXTROW)) str = but->drawstr;
else if (but->type == MENU) str = but->drawstr;
else if (but->drawstr[0]) str = but->drawstr;
else str = but->tip;
@ -544,7 +544,7 @@ static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data)
{
if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
if (but->type == MENU)
ui_set_but_val(but, data->value);
ui_check_but(but);
@ -558,16 +558,6 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
double value;
int w, lvalue, push;
/* local hack... */
if (but->type == BUT_TOGDUAL && data->togdual) {
if (but->pointype == UI_BUT_POIN_SHORT) {
but->poin += 2;
}
else if (but->pointype == UI_BUT_POIN_INT) {
but->poin += 4;
}
}
value = ui_get_but_val(but);
lvalue = (int)value;
@ -576,17 +566,6 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
if (w) lvalue = UI_BITBUT_CLR(lvalue, but->bitnr);
else lvalue = UI_BITBUT_SET(lvalue, but->bitnr);
if (but->type == TOGR) {
if (!data->togonly) {
lvalue = 1 << (but->bitnr);
ui_set_but_val(but, (double)lvalue);
}
else {
if (lvalue == 0) lvalue = 1 << (but->bitnr);
}
}
ui_set_but_val(but, (double)lvalue);
if (but->type == ICONTOG || but->type == ICONTOGN) ui_check_but(but);
}
@ -600,16 +579,6 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
if (but->type == ICONTOG || but->type == ICONTOGN) ui_check_but(but);
}
/* end local hack... */
if (but->type == BUT_TOGDUAL && data->togdual) {
if (but->pointype == UI_BUT_POIN_SHORT) {
but->poin -= 2;
}
else if (but->pointype == UI_BUT_POIN_INT) {
but->poin -= 4;
}
}
ui_apply_but_func(C, but);
data->retval = but->retval;
@ -673,41 +642,6 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
data->applied = true;
}
static void ui_apply_but_TOG3(bContext *C, uiBut *but, uiHandleButtonData *data)
{
if (but->pointype == UI_BUT_POIN_SHORT) {
short *sp = (short *)but->poin;
if (UI_BITBUT_TEST(sp[1], but->bitnr)) {
sp[1] = UI_BITBUT_CLR(sp[1], but->bitnr);
sp[0] = UI_BITBUT_CLR(sp[0], but->bitnr);
}
else if (UI_BITBUT_TEST(sp[0], but->bitnr)) {
sp[1] = UI_BITBUT_SET(sp[1], but->bitnr);
}
else {
sp[0] = UI_BITBUT_SET(sp[0], but->bitnr);
}
}
else {
if (UI_BITBUT_TEST(*(but->poin + 2), but->bitnr)) {
*(but->poin + 2) = UI_BITBUT_CLR(*(but->poin + 2), but->bitnr);
*(but->poin) = UI_BITBUT_CLR(*(but->poin), but->bitnr);
}
else if (UI_BITBUT_TEST(*(but->poin), but->bitnr)) {
*(but->poin + 2) = UI_BITBUT_SET(*(but->poin + 2), but->bitnr);
}
else {
*(but->poin) = UI_BITBUT_SET(*(but->poin), but->bitnr);
}
}
ui_check_but(but);
ui_apply_but_func(C, but);
data->retval = but->retval;
data->applied = true;
}
static void ui_apply_but_VEC(bContext *C, uiBut *but, uiHandleButtonData *data)
{
ui_set_but_vectorf(but, data->vec);
@ -732,24 +666,6 @@ static void ui_apply_but_CURVE(bContext *C, uiBut *but, uiHandleButtonData *data
data->applied = true;
}
static void ui_apply_but_IDPOIN(bContext *C, uiBut *but, uiHandleButtonData *data)
{
ui_set_but_string(C, but, data->str);
ui_check_but(but);
ui_apply_but_func(C, but);
data->retval = but->retval;
data->applied = true;
}
#ifdef WITH_INTERNATIONAL
static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *data)
{
ui_apply_but_func(C, but);
data->retval = but->retval;
data->applied = true;
}
#endif
/* ****************** drag drop code *********************** */
#ifdef USE_DRAG_TOGGLE
@ -1292,11 +1208,9 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
break;
case TOGBUT:
case TOG:
case TOGR:
case ICONTOG:
case ICONTOGN:
case TOGN:
case BUT_TOGDUAL:
case OPTION:
case OPTIONN:
ui_apply_but_TOG(C, but, data);
@ -1307,17 +1221,10 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
break;
case SCROLL:
case NUM:
case NUMABS:
case SLI:
case NUMSLI:
ui_apply_but_NUM(C, but, data);
break;
case TOG3:
ui_apply_but_TOG3(C, but, data);
break;
case MENU:
case ICONROW:
case ICONTEXTROW:
case BLOCK:
case PULLDOWN:
ui_apply_but_BLOCK(C, but, data);
@ -1342,14 +1249,6 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case BUT_CURVE:
ui_apply_but_CURVE(C, but, data);
break;
case IDPOIN:
ui_apply_but_IDPOIN(C, but, data);
break;
#ifdef WITH_INTERNATIONAL
case CHARTAB:
ui_apply_but_CHARTAB(C, but, data);
break;
#endif
case KEYEVT:
case HOTKEYEVT:
ui_apply_but_BUT(C, but, data);
@ -1392,7 +1291,7 @@ static void ui_but_drop(bContext *C, const wmEvent *event, uiBut *but, uiHandleB
for (wmd = drags->first; wmd; wmd = wmd->next) {
if (wmd->type == WM_DRAG_ID) {
/* align these types with UI_but_active_drop_name */
if (ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
ID *id = (ID *)wmd->poin;
if (but->poin == NULL && but->rnapoin.data == NULL) {}
@ -1433,7 +1332,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* numeric value */
if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
if (ELEM(but->type, NUM, NUMSLI)) {
if (but->poin == NULL && but->rnapoin.data == NULL) {
/* pass */
@ -1497,7 +1396,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* text/string and ID data */
else if (ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
else if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
uiHandleButtonData *active_data = but->active;
if (but->poin == NULL && but->rnapoin.data == NULL) {
@ -2041,7 +1940,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
BLI_str_rstrip_float_zero(data->str, '\0');
}
if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
if (ELEM(but->type, NUM, NUMSLI)) {
ui_convert_to_unit_alt_name(but, data->str, data->maxlen);
}
@ -2113,7 +2012,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
return;
for (but = actbut->next; but; but = but->next) {
if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (ELEM5(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut = but;
data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
@ -2122,7 +2021,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
}
}
for (but = block->buttons.first; but != actbut; but = but->next) {
if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (ELEM5(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut = but;
data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
@ -2141,7 +2040,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
return;
for (but = actbut->prev; but; but = but->prev) {
if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (ELEM5(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut = but;
data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
@ -2150,7 +2049,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
}
}
for (but = block->buttons.last; but != actbut; but = but->prev) {
if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (ELEM5(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut = but;
data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
@ -2345,7 +2244,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
/* exception that's useful for number buttons, some keyboard
* numpads have a comma instead of a period */
if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/
if (ELEM(but->type, NUM, NUMSLI)) { /* could use data->min*/
if (event->type == PADPERIOD && ascii == ',') {
ascii = '.';
utf8_buf = NULL; /* force ascii fallback */
@ -2517,14 +2416,6 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
menustr = but->str;
}
break;
case ICONROW:
menufunc = ui_block_func_ICONROW;
arg = but;
break;
case ICONTEXTROW:
menufunc = ui_block_func_ICONTEXTROW;
arg = but;
break;
case COLOR:
ui_get_but_vectorf(but, data->origvec);
copy_v3_v3(data->vec, data->origvec);
@ -3530,7 +3421,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
return WM_UI_HANDLER_BREAK;
}
else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) {
else if (but->type == MENU) {
if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
const int direction = (event->type == WHEELDOWNMOUSE) ? -1 : 1;
@ -4793,112 +4684,6 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
return WM_UI_HANDLER_CONTINUE;
}
#ifdef WITH_INTERNATIONAL
static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), const wmEvent *UNUSED(event))
{
/* XXX 2.50 bad global and state access */
#if 0
float sx, sy, ex, ey;
float width, height;
float butw, buth;
int mx, my, x, y, cs, che;
mx = event->x;
my = event->y;
ui_window_to_block(data->region, block, &mx, &my);
if (data->state == BUTTON_STATE_HIGHLIGHT) {
if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
/* Calculate the size of the button */
width = abs(BLI_rctf_size_x(&but->rect));
height = abs(BLI_rctf_size_y(&but->rect));
butw = floor(width / 12);
buth = floor(height / 6);
/* Initialize variables */
sx = but->rect.xmin;
ex = but->rect.xmin + butw;
sy = but->rect.ymin + height - buth;
ey = but->rect.ymin + height;
cs = G.charstart;
/* And the character is */
x = (int) ((mx / butw) - 0.5);
y = (int) (6 - ((my / buth) - 0.5));
che = cs + (y * 12) + x;
if (che > G.charmax)
che = 0;
if (G.obedit) {
do_textedit(0, 0, che);
}
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
else if (ELEM(event->type, WHEELUPMOUSE, PAGEUPKEY)) {
for (but = block->buttons.first; but; but = but->next) {
if (but->type == CHARTAB) {
G.charstart = G.charstart - (12 * 6);
if (G.charstart < 0)
G.charstart = 0;
if (G.charstart < G.charmin)
G.charstart = G.charmin;
ui_draw_but(but);
//Really nasty... to update the num button from the same butblock
for (bt = block->buttons.first; bt; bt = bt->next)
{
if (ELEM(bt->type, NUM, NUMABS)) {
ui_check_but(bt);
ui_draw_but(bt);
}
}
retval = UI_CONT;
break;
}
}
return WM_UI_HANDLER_BREAK;
}
else if (ELEM(event->type, WHEELDOWNMOUSE, PAGEDOWNKEY)) {
for (but = block->buttons.first; but; but = but->next) {
if (but->type == CHARTAB) {
G.charstart = G.charstart + (12 * 6);
if (G.charstart > (0xffff - 12 * 6))
G.charstart = 0xffff - (12 * 6);
if (G.charstart > G.charmax - 12 * 6)
G.charstart = G.charmax - 12 * 6;
ui_draw_but(but);
for (bt = block->buttons.first; bt; bt = bt->next)
{
if (ELEM(bt->type, NUM, NUMABS)) {
ui_check_but(bt);
ui_draw_but(bt);
}
}
but->flag |= UI_ACTIVE;
retval = UI_RETURN_OK;
break;
}
}
return WM_UI_HANDLER_BREAK;
}
}
#endif
return WM_UI_HANDLER_CONTINUE;
}
#endif
static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
VECCOPY2D(but->linkto, event->mval);
@ -5552,11 +5337,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
break;
case TOGBUT:
case TOG:
case TOGR:
case ICONTOG:
case ICONTOGN:
case TOGN:
case BUT_TOGDUAL:
case OPTION:
case OPTIONN:
retval = ui_do_but_TOG(C, but, data, event);
@ -5565,17 +5348,14 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
retval = ui_do_but_SCROLL(C, block, but, data, event);
break;
case NUM:
case NUMABS:
retval = ui_do_but_NUM(C, block, but, data, event);
break;
case SLI:
case NUMSLI:
retval = ui_do_but_SLI(C, block, but, data, event);
break;
case ROUNDBOX:
case LISTBOX:
case LABEL:
case TOG3:
case ROW:
case LISTROW:
case BUT_IMAGE:
@ -5593,7 +5373,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
retval = ui_do_but_VECTORSCOPE(C, block, but, data, event);
break;
case TEX:
case IDPOIN:
case SEARCH_MENU:
retval = ui_do_but_TEX(C, block, but, data, event);
break;
@ -5601,8 +5380,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
retval = ui_do_but_SEARCH_UNLINK(C, block, but, data, event);
break;
case MENU:
case ICONROW:
case ICONTEXTROW:
case BLOCK:
case PULLDOWN:
retval = ui_do_but_BLOCK(C, but, data, event);
@ -5631,16 +5408,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
case HSVCIRCLE:
retval = ui_do_but_HSVCIRCLE(C, block, but, data, event);
break;
#ifdef WITH_INTERNATIONAL
case CHARTAB:
retval = ui_do_but_CHARTAB(C, block, but, data, event);
break;
#else
/* do nothing */
case CHARTAB:
break;
#endif
case LINK:
case INLINK:
retval = ui_do_but_LINK(C, but, data, event);
@ -5713,7 +5480,7 @@ int UI_but_active_drop_name(bContext *C)
uiBut *but = ui_but_find_activated(ar);
if (but) {
if (ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK))
if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK))
return 1;
}
@ -5923,7 +5690,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
button_tooltip_timer_reset(C, but);
/* automatic open pulldown block timer */
if (ELEM3(but->type, BLOCK, PULLDOWN, ICONTEXTROW)) {
if (ELEM(but->type, BLOCK, PULLDOWN)) {
if (data->used_mouse && !data->autoopentimer) {
int time;
@ -6733,7 +6500,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u
if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
if (but->type == COLOR)
copy_v3_v3(data->vec, menu->retvec);
else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
else if (but->type == MENU)
data->value = menu->retvalue;
}
@ -7207,11 +6974,6 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH
doit = TRUE;
}
}
/* exception for menus like layer buts, with button aligning they're not drawn in order */
else if (but->type == TOGR) {
if (but->bitnr == act - 1)
doit = TRUE;
}
else if (count == act) {
doit = TRUE;
}

@ -230,10 +230,6 @@ struct uiBut {
short modifier_key;
short iconadd;
/* IDPOIN data */
uiIDPoinFuncFP idpoin_func;
ID **idpoin_idpp;
/* BLOCK data */
uiBlockCreateFunc block_create_func;
@ -460,8 +456,6 @@ struct uiPopupBlockHandle {
};
uiBlock *ui_block_func_COLOR(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
void ui_block_func_ICONROW(struct bContext *C, uiLayout *layout, void *arg_but);
void ui_block_func_ICONTEXTROW(struct bContext *C, uiLayout *layout, void *arg_but);
struct ARegion *ui_tooltip_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
void ui_tooltip_free(struct bContext *C, struct ARegion *ar);

@ -481,7 +481,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
data->totline++;
}
if (ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
/* full string */
ui_get_but_string(but, buf, sizeof(buf));
if (buf[0]) {
@ -1866,53 +1866,6 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
menudata_free(md);
}
void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
{
uiBlock *block = uiLayoutGetBlock(layout);
uiPopupBlockHandle *handle = block->handle;
uiBut *but = arg_but;
int a;
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
for (a = (int)but->hardmin; a <= (int)but->hardmax; a++)
uiDefIconButF(block, BUTM, B_NOP, but->icon + (a - but->hardmin), 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
&handle->retvalue, (float)a, 0.0, 0, -1, "");
}
void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
{
uiBlock *block = uiLayoutGetBlock(layout);
uiPopupBlockHandle *handle = block->handle;
uiBut *but = arg_but, *bt;
MenuData *md;
MenuEntry *entry;
int a;
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
md = decompose_menu_string(but->str);
/* title */
if (md->title) {
bt = uiDefBut(block, LABEL, 0, md->title, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
bt->flag = UI_TEXT_LEFT;
}
/* loop through the menu options and draw them out with icons & text labels */
for (a = 0; a < md->nitems; a++) {
entry = &md->items[md->nitems - a - 1];
if (entry->sepr)
uiItemS(layout);
else
uiDefIconTextButF(block, BUTM, B_NOP, (short)((but->icon) + (entry->retval - but->hardmin)), entry->str,
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, -1, "");
}
menudata_free(md);
}
#if 0
static void ui_warp_pointer(int x, int y)
{

@ -113,7 +113,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
if (icon == ICON_DOT)
icon = 0;
but = uiDefIconTextButR_prop(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
but = uiDefIconTextButR_prop(block, SEARCH_MENU, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
break;
}
case PROP_COLLECTION:

@ -891,23 +891,12 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, const rcti
float ofs = 1.0f / aspect;
if (but->flag & UI_ICON_LEFT) {
if (but->type == BUT_TOGDUAL) {
if (but->drawstr[0]) {
xs = rect->xmin - ofs;
}
else {
xs = (rect->xmin + rect->xmax - height) / 2.0f;
}
}
else if (but->block->flag & UI_BLOCK_LOOP) {
if (but->block->flag & UI_BLOCK_LOOP) {
if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK))
xs = rect->xmin + 4.0f * ofs;
else
xs = rect->xmin + ofs;
}
else if ((but->type == ICONROW) || (but->type == ICONTEXTROW)) {
xs = rect->xmin + 3.0f * ofs;
}
else {
xs = rect->xmin + 4.0f * ofs;
}
@ -1220,13 +1209,12 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
#if 0
ui_rasterpos_safe(x, y, but->aspect);
if (but->type == IDPOIN) transopts = 0; /* no translation, of course! */
else transopts = ui_translate_buttons();
transopts = ui_translate_buttons();
#endif
/* cut string in 2 parts - only for menu entries */
if ((but->block->flag & UI_BLOCK_LOOP)) {
if (ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS) == 0) {
if (ELEM3(but->type, NUM, TEX, NUMSLI) == 0) {
cpoin = strchr(but->drawstr, '|');
if (cpoin) *cpoin = 0;
}
@ -1292,7 +1280,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
if (but->editstr && but->pos >= 0) {
ui_text_clip_cursor(fstyle, but, rect);
}
else if (ELEM4(but->type, NUM, NUMABS, NUMSLI, SLI)) {
else if (ELEM(but->type, NUM, NUMSLI)) {
ui_text_clip_right_label(fstyle, but, rect);
}
else if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
@ -1306,64 +1294,46 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
}
/* check for button text label */
if (but->type == ICONTEXTROW) {
widget_draw_icon(but, (BIFIconID) (but->icon + but->iconadd), 1.0f, rect);
if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) {
int tmp = rect->xmin;
rect->xmin = rect->xmax - BLI_rcti_size_y(rect) - 1;
widget_draw_icon(but, ICON_LAYER_USED, alpha, rect);
rect->xmin = tmp;
}
else {
if (but->type == BUT_TOGDUAL) {
int dualset = 0;
if (but->pointype == UI_BUT_POIN_SHORT) {
dualset = UI_BITBUT_TEST(*(((short *)but->poin) + 1), but->bitnr);
}
else if (but->pointype == UI_BUT_POIN_INT) {
dualset = UI_BITBUT_TEST(*(((int *)but->poin) + 1), but->bitnr);
}
/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
* and offset the text label to accommodate it */
widget_draw_icon(but, ICON_DOT, dualset ? alpha : 0.25f, rect);
}
else if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) {
int tmp = rect->xmin;
rect->xmin = rect->xmax - BLI_rcti_size_y(rect) - 1;
widget_draw_icon(but, ICON_LAYER_USED, alpha, rect);
rect->xmin = tmp;
}
if (but->flag & UI_HAS_ICON) {
widget_draw_icon(but, but->icon + but->iconadd, alpha, rect);
/* icons default draw 0.8f x height */
rect->xmin += (int)(0.8f * BLI_rcti_size_y(rect));
/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
* and offset the text label to accommodate it */
if (but->flag & UI_HAS_ICON) {
widget_draw_icon(but, but->icon + but->iconadd, alpha, rect);
/* icons default draw 0.8f x height */
rect->xmin += (int)(0.8f * BLI_rcti_size_y(rect));
if (but->editstr || (but->flag & UI_TEXT_LEFT)) {
rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
}
else if ((but->flag & UI_TEXT_RIGHT)) {
rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
}
}
else if ((but->flag & UI_TEXT_LEFT)) {
if (but->editstr || (but->flag & UI_TEXT_LEFT)) {
rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
}
else if ((but->flag & UI_TEXT_RIGHT)) {
rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
}
/* unlink icon for this button type */
if (but->type == SEARCH_MENU_UNLINK && !but->editstr && but->drawstr[0]) {
rcti temp = *rect;
temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f);
widget_draw_icon(but, ICON_X, alpha, &temp);
}
/* always draw text for textbutton cursor */
widget_draw_text(fstyle, wcol, but, rect);
}
else if ((but->flag & UI_TEXT_LEFT)) {
rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
}
else if ((but->flag & UI_TEXT_RIGHT)) {
rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
}
/* unlink icon for this button type */
if (but->type == SEARCH_MENU_UNLINK && !but->editstr && but->drawstr[0]) {
rcti temp = *rect;
temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f);
widget_draw_icon(but, ICON_X, alpha, &temp);
}
/* always draw text for textbutton cursor */
widget_draw_text(fstyle, wcol, but, rect);
ui_button_text_password_hide(password_str, but, TRUE);
}
@ -3279,7 +3249,6 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case TOGBUT:
case TOG:
case TOGN:
case TOG3:
wt = widget_type(UI_WTYPE_TOGGLE);
break;
@ -3300,7 +3269,6 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case MENU:
case BLOCK:
case ICONTEXTROW:
/* new node-link button, not active yet XXX */
if (but->flag & UI_BUT_NODE_LINK)
wt = widget_type(UI_WTYPE_MENU_NODE_LINK);

@ -395,79 +395,6 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
return ok;
}
/* *************************************** */
#if 0
static void seam_edgehash_insert_face(EdgeHash *ehash, MPoly *mp, MLoop *loopstart)
{
MLoop *ml1, *ml2;
int a;
for (a = 0; a < mp->totloop; a++) {
ml1 = loopstart + a;
ml2 = loopstart + (a + 1) % mp->totloop;
BLI_edgehash_insert(ehash, ml1->v, ml2->v, NULL);
}
}
void seam_mark_clear_tface(Scene *scene, short mode)
{
Mesh *me;
MPoly *mp;
MLoop *ml1, *ml2;
MEdge *med;
int a, b;
me = BKE_mesh_from_object(OBACT);
if (me == 0 || me->totpoly == 0) return;
if (mode == 0)
mode = pupmenu(IFACE_("Seams %t|Mark Border Seam %x1|Clear Seam %x2"));
if (mode != 1 && mode != 2)
return;
if (mode == 2) {
EdgeHash *ehash = BLI_edgehash_new();
for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++)
if (!(mp->flag & ME_HIDE) && (mp->flag & ME_FACE_SEL))
seam_edgehash_insert_face(ehash, mp, me->mloop + mp->loopstart);
for (a = 0, med = me->medge; a < me->totedge; a++, med++)
if (BLI_edgehash_haskey(ehash, med->v1, med->v2))
med->flag &= ~ME_SEAM;
BLI_edgehash_free(ehash, NULL);
}
else {
/* mark edges that are on both selected and deselected faces */
EdgeHash *ehash1 = BLI_edgehash_new();
EdgeHash *ehash2 = BLI_edgehash_new();
for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++) {
if ((mp->flag & ME_HIDE) || !(mp->flag & ME_FACE_SEL))
seam_edgehash_insert_face(ehash1, mp, me->mloop + mp->loopstart);
else
seam_edgehash_insert_face(ehash2, mp, me->mloop + mp->loopstart);
}
for (a = 0, med = me->medge; a < me->totedge; a++, med++)
if (BLI_edgehash_haskey(ehash1, med->v1, med->v2) &&
BLI_edgehash_haskey(ehash2, med->v1, med->v2))
med->flag |= ME_SEAM;
BLI_edgehash_free(ehash1, NULL);
BLI_edgehash_free(ehash2, NULL);
}
// XXX if (G.debug_value == 8)
// unwrap_lscm(1);
me->drawflag |= ME_DRAWSEAMS;
}
#endif
bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], bool extend, bool deselect, bool toggle)
{
Mesh *me;

@ -329,36 +329,27 @@ static int edbm_extrude_mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOpe
zero_v3(nor);
/* XXX If those popup menus were to be enabled again, please get rid of this "menu string" syntax! */
if (em->selectmode & SCE_SELECT_VERTEX) {
if (em->bm->totvertsel == 0) nr = 0;
else if (em->bm->totvertsel == 1) nr = 4;
else if (em->bm->totedgesel == 0) nr = 4;
else if (em->bm->totfacesel == 0)
nr = 3; /* pupmenu("Extrude %t|Only Edges %x3|Only Vertices %x4"); */
nr = 3;
else if (em->bm->totfacesel == 1)
nr = 1; /* pupmenu("Extrude %t|Region %x1|Only Edges% x3|Only Vertices %x4"); */
nr = 1;
else
nr = 1; /* pupmenu("Extrude %t|Region %x1|Individual Faces %x2|Only Edges %x3|Only Vertices %x4"); */
nr = 1;
}
else if (em->selectmode & SCE_SELECT_EDGE) {
if (em->bm->totedgesel == 0) nr = 0;
nr = 1;
#if 0
else if (em->totedgesel == 1) nr = 3;
else if (em->totfacesel == 0) nr = 3;
else if (em->totfacesel == 1)
nr = 1; /* pupmenu("Extrude %t|Region %x1|Only Edges %x3"); */
else
nr = 1; /* pupmenu("Extrude %t|Region %x1|Individual Faces %x2|Only Edges %x3"); */
#endif
}
else {
if (em->bm->totfacesel == 0) nr = 0;
else if (em->bm->totfacesel == 1) nr = 1;
else
nr = 1; /* pupmenu("Extrude %t|Region %x1|Individual Faces %x2"); */
nr = 1;
}
if (nr < 1) return 'g';