Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / interface / interface.c
index 7180e18ab92baf9d9687fe553107700354773b64..e1ca6c60a7429aca65b57aa0943173e577faf534 100644 (file)
@@ -56,7 +56,7 @@
 #include "BKE_screen.h"
 #include "BKE_idprop.h"
 
-#include "BIF_gl.h"
+#include "GPU_matrix.h"
 
 #include "BLF_api.h"
 #include "BLT_translation.h"
@@ -499,6 +499,7 @@ static int ui_but_calc_float_precision(uiBut *but, double value)
 static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines, int dashInactiveLines)
 {
        rcti rect;
+       float color[4] = {1.0f};
 
        if (line->from == NULL || line->to == NULL) return;
        
@@ -508,15 +509,15 @@ static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines, int das
        rect.ymax = BLI_rctf_cent_y(&line->to->rect);
        
        if (dashInactiveLines)
-               UI_ThemeColor(TH_GRID);
+               UI_GetThemeColor4fv(TH_GRID, color);
        else if (line->flag & UI_SELECT)
-               glColor3ub(100, 100, 100);
+               rgba_float_args_set_ch(color, 100, 100, 100, 255);
        else if (highlightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)))
-               UI_ThemeColor(TH_TEXT_HI);
+               UI_GetThemeColor4fv(TH_TEXT_HI, color);
        else
-               glColor3ub(0, 0, 0);
+               rgba_float_args_set_ch(color, 0, 0, 0, 255);
 
-       ui_draw_link_bezier(&rect);
+       ui_draw_link_bezier(&rect, color);
 }
 
 static void ui_draw_links(uiBlock *block)
@@ -1376,11 +1377,9 @@ void UI_block_draw(const bContext *C, uiBlock *block)
        ui_but_to_pixelrect(&rect, ar, block, NULL);
        
        /* pixel space for AA widgets */
-       glMatrixMode(GL_PROJECTION);
-       glPushMatrix();
-       glMatrixMode(GL_MODELVIEW);
-       glPushMatrix();
-       glLoadIdentity();
+       gpuPushProjectionMatrix();
+       gpuPushMatrix();
+       gpuLoadIdentity();
 
        wmOrtho2_region_pixelspace(ar);
        
@@ -1405,10 +1404,8 @@ void UI_block_draw(const bContext *C, uiBlock *block)
        }
        
        /* restore matrix */
-       glMatrixMode(GL_PROJECTION);
-       glPopMatrix();
-       glMatrixMode(GL_MODELVIEW);
-       glPopMatrix();
+       gpuPopProjectionMatrix();
+       gpuPopMatrix();
 
        if (multisample_enabled)
                glEnable(GL_MULTISAMPLE);
@@ -1462,6 +1459,7 @@ int ui_but_is_pushed_ex(uiBut *but, double *value)
                                break;
                        case UI_BTYPE_ROW:
                        case UI_BTYPE_LISTROW:
+                       case UI_BTYPE_TAB:
                                UI_GET_BUT_VALUE_INIT(but, *value);
                                /* support for rna enum buts */
                                if (but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
@@ -4400,7 +4398,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c
                for (item = item_array; item->identifier; item++) {
                        /* 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, SET_INT_IN_POINTER(item->value), 0))
+                               if (false == UI_search_item_add(items, item->name, SET_INT_IN_POINTER(item->value), item->icon))
                                        break;
                        }
                }