Commit: 3bb7e14618cb928d43fecf0a8930a1edd85dde3e
Author: Campbell Barton
Date:   Tue Mar 24 15:05:27 2015 +1100
Branches: master
https://developer.blender.org/rB3bb7e14618cb928d43fecf0a8930a1edd85dde3e

UI: remove UI_BTYPE_SEARCH_MENU_UNLINK

Internal change only,
use UI_BTYPE_SEARCH_MENU with an unlink flag instead.

They are really the same button type, one just happens to have the option to 
unlink.

===================================================================

M       source/blender/editors/include/UI_interface.h
M       source/blender/editors/interface/interface.c
M       source/blender/editors/interface/interface_handlers.c
M       source/blender/editors/interface/interface_layout.c
M       source/blender/editors/interface/interface_regions.c
M       source/blender/editors/interface/interface_widgets.c

===================================================================

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index 4542627..02ae098 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -185,6 +185,7 @@ enum {
        UI_BUT_HAS_SEP_CHAR    = (1 << 27),  /* but->str contains UI_SEP_CHAR, 
used for key shortcuts */
        UI_BUT_TIP_FORCE       = (1 << 28),  /* force show tooltips when 
holding option/alt if U's USER_TOOLTIPS is off */
        UI_BUT_TEXTEDIT_UPDATE = (1 << 29),  /* when widget is in textedit 
mode, update value on each char stroke */
+       UI_BUT_SEARCH_UNLINK   = (1 << 30),  /* show unlink for search button */
 };
 
 #define UI_PANEL_WIDTH          340
@@ -279,7 +280,6 @@ typedef enum {
        UI_BTYPE_WAVEFORM               = (49 << 9),
        UI_BTYPE_VECTORSCOPE            = (50 << 9),
        UI_BTYPE_PROGRESS_BAR           = (51 << 9),
-       UI_BTYPE_SEARCH_MENU_UNLINK     = (52 << 9),
        UI_BTYPE_NODE_SOCKET            = (53 << 9),
        UI_BTYPE_SEPR                   = (54 << 9),
        UI_BTYPE_SEPR_LINE              = (55 << 9),
diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index 48a7cf4..5714a40 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1930,7 +1930,7 @@ void ui_but_value_set(uiBut *but, double value)
 
 int ui_but_string_get_max_length(uiBut *but)
 {
-       if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU, 
UI_BTYPE_SEARCH_MENU_UNLINK))
+       if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU))
                return but->hardmax;
        else
                return UI_MAX_DRAW_STR;
@@ -2031,7 +2031,7 @@ static float ui_get_but_step_unit(uiBut *but, float 
step_default)
  */
 void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, const 
int float_precision)
 {
-       if (but->rnaprop && ELEM(but->type, UI_BTYPE_TEXT, 
UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) {
+       if (but->rnaprop && ELEM(but->type, UI_BTYPE_TEXT, 
UI_BTYPE_SEARCH_MENU)) {
                PropertyType type;
                const char *buf = NULL;
                int buf_len;
@@ -2073,7 +2073,7 @@ void ui_but_string_get_ex(uiBut *but, char *str, const 
size_t maxlen, const int
                BLI_strncpy(str, but->poin, maxlen);
                return;
        }
-       else if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, 
UI_BTYPE_SEARCH_MENU_UNLINK)) {
+       else if (but->type == UI_BTYPE_SEARCH_MENU) {
                /* string */
                BLI_strncpy(str, but->poin, maxlen);
                return;
@@ -2194,7 +2194,7 @@ static void ui_but_string_free_internal(uiBut *but)
 
 bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
 {
-       if (but->rnaprop && ELEM(but->type, UI_BTYPE_TEXT, 
UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) {
+       if (but->rnaprop && ELEM(but->type, UI_BTYPE_TEXT, 
UI_BTYPE_SEARCH_MENU)) {
                if (RNA_property_editable(&but->rnapoin, but->rnaprop)) {
                        PropertyType type;
 
@@ -2246,7 +2246,7 @@ bool ui_but_string_set(bContext *C, uiBut *but, const 
char *str)
 
                return true;
        }
-       else if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, 
UI_BTYPE_SEARCH_MENU_UNLINK)) {
+       else if (but->type == UI_BTYPE_SEARCH_MENU) {
                /* string */
                BLI_strncpy(but->poin, str, but->hardmax);
                return true;
@@ -2754,7 +2754,6 @@ void ui_but_update(uiBut *but)
 
                case UI_BTYPE_TEXT:
                case UI_BTYPE_SEARCH_MENU:
-               case UI_BTYPE_SEARCH_MENU_UNLINK:
                        if (!but->editstr) {
                                char str[UI_MAX_DRAW_STR];
 
@@ -3139,7 +3138,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int 
retval, const char *str,
                 ELEM(but->type,
                      UI_BTYPE_MENU, UI_BTYPE_TEXT, UI_BTYPE_LABEL,
                      UI_BTYPE_BLOCK, UI_BTYPE_BUT_MENU, UI_BTYPE_SEARCH_MENU,
-                     UI_BTYPE_PROGRESS_BAR, UI_BTYPE_SEARCH_MENU_UNLINK))
+                     UI_BTYPE_PROGRESS_BAR))
        {
                but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT);
        }
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 68a69c4..dc8018c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -413,7 +413,7 @@ bool ui_but_is_editable_as_text(const uiBut *but)
 {
        return  ELEM(but->type,
                     UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER,
-                    UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK);
+                    UI_BTYPE_SEARCH_MENU);
 
 }
 
@@ -1629,7 +1629,6 @@ static void ui_apply_but(bContext *C, uiBlock *block, 
uiBut *but, uiHandleButton
                        ui_apply_but_BUT(C, but, data);
                        break;
                case UI_BTYPE_TEXT:
-               case UI_BTYPE_SEARCH_MENU_UNLINK:
                case UI_BTYPE_SEARCH_MENU:
                        ui_apply_but_TEX(C, but, data);
                        break;
@@ -1732,13 +1731,13 @@ 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 (ELEM(but->type, UI_BTYPE_TEXT, 
UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) {
+                       if (ELEM(but->type, UI_BTYPE_TEXT, 
UI_BTYPE_SEARCH_MENU)) {
                                ID *id = (ID *)wmd->poin;
                                
                                button_activate_state(C, but, 
BUTTON_STATE_TEXT_EDITING);
                                BLI_strncpy(data->str, id->name + 2, 
data->maxlen);
 
-                               if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, 
UI_BTYPE_SEARCH_MENU_UNLINK)) {
+                               if (ELEM(but->type, UI_BTYPE_SEARCH_MENU)) {
                                        but->changed = true;
                                        ui_searchbox_update(C, data->searchbox, 
but, true);
                                }
@@ -1879,7 +1878,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, 
uiHandleButtonData *data,
        }
 
        /* text/string and ID data */
-       else if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU, 
UI_BTYPE_SEARCH_MENU_UNLINK)) {
+       else if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) {
                uiHandleButtonData *active_data = but->active;
 
                if (but->poin == NULL && but->rnapoin.data == NULL) {
@@ -1899,7 +1898,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, 
uiHandleButtonData *data,
                        else
                                BLI_strncpy(active_data->str, buf_paste, 
active_data->maxlen);
 
-                       if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, 
UI_BTYPE_SEARCH_MENU_UNLINK)) {
+                       if (but->type == UI_BTYPE_SEARCH_MENU) {
                                /* else uiSearchboxData.active member is not 
updated [#26856] */
                                but->changed = true;
                                ui_searchbox_update(C, data->searchbox, but, 
true);
@@ -2092,7 +2091,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, 
uiHandleButtonData *data, con
 
        BLI_strncpy(origstr, but->editstr, data->maxlen);
 
-       if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU, 
UI_BTYPE_SEARCH_MENU_UNLINK)) {
+       if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) {
                if (but->flag & UI_HAS_ICON) {
                        startx += UI_DPI_ICON_SIZE / aspect;
                }
@@ -2539,7 +2538,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, 
uiHandleButtonData *data)
        but->selend = len;
 
        /* optional searchbox */
-       if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) 
{
+       if (but->type ==  UI_BTYPE_SEARCH_MENU) {
                data->searchbox = ui_searchbox_create(C, data->region, but);
                ui_searchbox_update(C, data->searchbox, but, true); /* true = 
reset */
        }
@@ -6331,7 +6330,9 @@ static int ui_do_button(bContext *C, uiBlock *block, 
uiBut *but, const wmEvent *
                                        WM_operator_name_call(C, 
"UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, NULL);
                                        return WM_UI_HANDLER_BREAK;
                                }
-                               else if (but->type == 
UI_BTYPE_SEARCH_MENU_UNLINK) {
+                               else if ((but->type == UI_BTYPE_SEARCH_MENU) &&
+                                        (but->flag & UI_BUT_SEARCH_UNLINK))
+                               {
                                        if (but->rnaprop && 
RNA_property_type(but->rnaprop) == PROP_POINTER) {
                                                StructRNA *type = 
RNA_property_pointer_type(&but->rnapoin, but->rnaprop);
                                                const short idcode = 
RNA_type_to_ID_code(type);
@@ -6488,11 +6489,16 @@ static int ui_do_button(bContext *C, uiBlock *block, 
uiBut *but, const wmEvent *
                        break;
                case UI_BTYPE_TEXT:
                case UI_BTYPE_SEARCH_MENU:
+                       if ((but->type == UI_BTYPE_SEARCH_MENU) &&
+                           (but->flag & UI_BUT_SEARCH_UNLINK))
+                       {
+                               retval = ui_do_but_SEARCH_UNLINK(C, block, but, 
data, event);
+                               if (retval & WM_UI_HANDLER_BREAK) {
+                                       break;
+                               }
+                       }
                        retval = ui_do_but_TEX(C, block, but, data, event);
                        break;
-               case UI_BTYPE_SEARCH_MENU_UNLINK:
-                       retval = ui_do_but_SEARCH_UNLINK(C, block, but, data, 
event);
-                       break;
                case UI_BTYPE_MENU:
                case UI_BTYPE_BLOCK:
                case UI_BTYPE_PULLDOWN:
@@ -6731,7 +6737,7 @@ bool UI_but_active_drop_name(bContext *C)
        uiBut *but = ui_but_find_active_in_region(ar);
 
        if (but) {
-               if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU, 
UI_BTYPE_SEARCH_MENU_UNLINK))
+               if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU))
                        return 1;
        }
        
@@ -6848,9 +6854,10 @@ static bool ui_but_is_interactive(const uiBut *but, 
const bool labeledit)
 
 bool ui_but_is_search_unlink_visible(const uiBut *but)
 {
-       BLI_assert(but->type == UI_BTYPE_SEARCH_MENU_UNLINK);
+       BLI_assert(but->type == UI_BTYPE_SEARCH_MENU);
        return ((but->editstr == NULL) &&
-               (but->drawstr[0] != '\0'));
+               (but->drawstr[0] != '\0') &&
+               (but->flag & UI_BUT_SEARCH_UNLINK));
 }
 
 /* x and y are only used in case event is NULL... */
@@ -7131,7 +7138,7 @@ static void button_activate_init(bContext *C, ARegion 
*ar, uiBut *but, uiButtonA
        copy_v2_fl(data->ungrab_mval, FLT_MAX);
 #endif
 
-       if (ELEM(but->type, UI_BTYPE_CURVE, UI_BTYPE_SEARCH_MENU, 
UI_BTYPE_SEARCH_MENU_UNLINK)) {
+       if (ELEM(but->type, UI_BTYPE_CURVE, UI_BTYPE_SEARCH_MENU)) {
                /* XXX curve is temp */
        }
        else {
@@ -9106,7 +9113,7 @@ static int ui_handle_menus_recursive(
 
        /* now handle events for our own menu */
        if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
-               const bool do_but_search = (but && ELEM(but->type, 
UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK));
+               const bool do_but_search = (but && (but->type == 
UI_BTYPE_SEARCH_MENU));
                if (submenu && submenu->menuretval) {
                        const bool do_ret_out_parent = (submenu->menuretval & 
UI_RETURN_OUT_PARENT) != 0;
                        retval = ui_handle_menu_return_submenu(C, event, menu);
diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index 44c1ed4..eeda7a2 100644
--- a/source/blender/editors/interface/

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to