[Bf-blender-cvs] [904129f] master: Squashed commit of the following:

Bastien Montagne noreply at git.blender.org
Thu Nov 21 16:51:25 CET 2013


Commit: 904129fd9b11988c5915d940773552d2110f23ab
Author: Bastien Montagne
Date:   Thu Nov 21 16:51:29 2013 +0100
http://developer.blender.org/rB904129fd9b11988c5915d940773552d2110f23ab

Squashed commit of the following:

commit b8b7180760b7c57f15b9930c29207febcf5fefb3
Author: Bastien Montagne <montagne29 at wanadoo.fr>
Date:   Thu Nov 21 16:31:16 2013 +0100

    Code cleanup: replace "LISTLABEL" button type by an "UI_BUT_LIST_ITEM" button flag.

    Summary:
    Rationals:
    I) I was never that happy to have a full button type just to set custom colors to labels inside listitems!
    II) If we use (as planned) TEX buttons instead of labels to allow listitems click-rename, I'd like to be able to use listitems' theme color here as well, much easier witha flag than adding yet another button type!

    Note: related to D8

    Reviewers: brecht

    Differential Revision: http://developer.blender.org/D25

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

M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/addons_contrib
M	scons
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_widgets.c

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index cb1967c..d3e0405 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit cb1967cc63a6d2d75d2b59cdf91c5f5645285aea
+Subproject commit d3e0405103f9ccabb8e567a8c69e9d4015aaa3bb
diff --git a/release/scripts/addons b/release/scripts/addons
index 48bdb7b..4d8cb6c 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 48bdb7b52fe827cbc21d50cce3079223243414bd
+Subproject commit 4d8cb6c294727ff10afeb548759f629b0c2169d6
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 31545d2..4fe6a9e 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 31545d25c9cb41d271a3f3ef84d327708572290e
+Subproject commit 4fe6a9e046f9578a0dadb1186269ac5e406a8c15
diff --git a/scons b/scons
index ccea0f0..2d6ebcb 160000
--- a/scons
+++ b/scons
@@ -1 +1 @@
-Subproject commit ccea0f01de1c3e9210086bd447df71bae353fa07
+Subproject commit 2d6ebcb23909058b846aa232ecb2fee497924cf8
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 53bfc94..0c37d35 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -170,12 +170,16 @@ enum {
 
 	UI_BUT_VEC_SIZE_LOCK = (1 << 22),  /* used to flag if color hsv-circle should keep luminance */
 	UI_BUT_COLOR_CUBIC   = (1 << 23),  /* cubic saturation for the color wheel */
+	UI_BUT_LIST_ITEM     = (1 << 24),  /* This but is "inside" a list item (currently used to change theme colors). */
 };
 
 #define UI_PANEL_WIDTH          340
 #define UI_COMPACT_PANEL_WIDTH  160
 
 /* but->drawflag - these flags should only affect how the button is drawn. */
+/* Note: currently, these flags _are not passed_ to the widget's state() or draw() functions
+ *       (except for the 'align' ones)!
+ */
 enum {
 	/* draw enum-like up/down arrows for button */
 	UI_BUT_DRAW_ENUM_ARROWS  = (1 << 0),
@@ -263,7 +267,6 @@ typedef enum {
 	PROGRESSBAR   = (51 << 9),
 	SEARCH_MENU_UNLINK   = (52 << 9),
 	NODESOCKET    = (53 << 9),
-	LISTLABEL     = (54 << 9),
 } eButType;
 
 #define BUTTYPE     (63 << 9)
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 33a0543..db53809 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -301,7 +301,7 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
 
 static bool ui_but_editable(uiBut *but)
 {
-	return ELEM6(but->type, LABEL, LISTLABEL, SEPR, ROUNDBOX, LISTBOX, PROGRESSBAR);
+	return ELEM5(but->type, LABEL, SEPR, ROUNDBOX, LISTBOX, PROGRESSBAR);
 }
 
 static uiBut *ui_but_prev(uiBut *but)
@@ -2097,7 +2097,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
 	uiBut *but;
 
 	/* label and roundbox can overlap real buttons (backdrops...) */
-	if (ELEM5(actbut->type, LABEL, LISTLABEL, SEPR, ROUNDBOX, LISTBOX))
+	if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
 		return;
 
 	for (but = actbut->next; but; but = but->next) {
@@ -2125,7 +2125,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
 	uiBut *but;
 
 	/* label and roundbox can overlap real buttons (backdrops...) */
-	if (ELEM5(actbut->type, LABEL, LISTLABEL, SEPR, ROUNDBOX, LISTBOX))
+	if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
 		return;
 
 	for (but = actbut->prev; but; but = but->prev) {
@@ -5675,7 +5675,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
 			break;
 		case ROUNDBOX:
 		case LABEL:
-		case LISTLABEL:
 		case ROW:
 		case LISTROW:
 		case BUT_IMAGE:
@@ -5888,7 +5887,7 @@ static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
 bool ui_is_but_interactive(uiBut *but)
 {
 	/* note, LABEL is included for highlights, this allows drags */
-	if (ELEM(but->type, LABEL, LISTLABEL) && but->dragpoin == NULL)
+	if ((but->type == LABEL) && but->dragpoin == NULL)
 		return false;
 	if (ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX))
 		return false;
@@ -7444,7 +7443,7 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH
 						for (but = block->buttons.first; but; but = but->next) {
 							int doit = FALSE;
 							
-							if (but->type != LABEL && but->type != LISTLABEL && but->type != SEPR)
+							if (!ELEM(but->type, LABEL, SEPR))
 								count++;
 							
 							/* exception for rna layer buts */
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 30a0eb4..30d8535 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -95,7 +95,6 @@ typedef enum {
 	UI_WTYPE_SCROLL,
 	UI_WTYPE_LISTITEM,
 	UI_WTYPE_PROGRESSBAR,
-	UI_WTYPE_LISTLABEL,
 } uiWidgetTypeEnum;
 
 /* menu scrolling */
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 4517c09..e3686b7 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1687,7 +1687,7 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
 
 	/* Mark as a label inside a listbox. */
 	if (block->flag & UI_BLOCK_LIST_ITEM) {
-		but->type = LISTLABEL;
+		but->flag |= UI_BUT_LIST_ITEM;
 	}
 
 	return but;
@@ -2457,7 +2457,7 @@ void ui_layout_list_set_labels_active(uiLayout *layout)
 		if (bitem->item.type != ITEM_BUTTON) {
 			ui_layout_list_set_labels_active((uiLayout *)(&bitem->item));
 		}
-		else if (bitem->but->type == LISTLABEL) {
+		else if (bitem->but->flag & UI_BUT_LIST_ITEM) {
 			uiButSetFlag(bitem->but, UI_SELECT);
 		}
 	}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 76be6ff..3058888 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -882,7 +882,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, const rcti
 	}
 	
 	/* extra feature allows more alpha blending */
-	if (ELEM(but->type, LABEL, LISTLABEL) && but->a1 == 1.0f)
+	if ((but->type == LABEL) && but->a1 == 1.0f)
 		alpha *= but->a2;
 	
 	glEnable(GL_BLEND);
@@ -2866,12 +2866,21 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
 /* labels use Editor theme colors for text */
 static void widget_state_label(uiWidgetType *wt, int state)
 {
-	/* call this for option button */
-	widget_state(wt, state);
-	if (state & UI_SELECT)
-		UI_GetThemeColor3ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
-	else
-		UI_GetThemeColor3ubv(TH_TEXT, (unsigned char *)wt->wcol.text);
+	if (state & UI_BUT_LIST_ITEM) {
+		/* Override default label theme's colors. */
+		bTheme *btheme = UI_GetTheme();
+		wt->wcol_theme = &btheme->tui.wcol_list_item;
+		/* call this for option button */
+		widget_state(wt, state);
+	}
+	else {
+		/* call this for option button */
+		widget_state(wt, state);
+		if (state & UI_SELECT)
+			UI_GetThemeColor3ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
+		else
+			UI_GetThemeColor3ubv(TH_TEXT, (unsigned char *)wt->wcol.text);
+	}
 }
 
 static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
@@ -2991,11 +3000,6 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
 		case UI_WTYPE_REGULAR:
 			break;
 
-		case UI_WTYPE_LISTLABEL:
-			wt.wcol_theme = &btheme->tui.wcol_list_item;
-			wt.draw = NULL;
-			/* Can't use usual label code. */
-			break;
 		case UI_WTYPE_LABEL:
 			wt.draw = NULL;
 			wt.state = widget_state_label;
@@ -3245,11 +3249,6 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
 					fstyle = &style->widgetlabel;
 				}
 				break;
-				
-			case LISTLABEL:
-				wt = widget_type(UI_WTYPE_LISTLABEL);
-				fstyle = &style->widgetlabel;
-				break;
 
 			case SEPR:
 				break;




More information about the Bf-blender-cvs mailing list