[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40624] trunk/blender/source/blender/ editors/interface: minor changes to interface code (no functional changes)

Campbell Barton ideasman42 at gmail.com
Tue Sep 27 19:04:39 CEST 2011


Revision: 40624
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40624
Author:   campbellbarton
Date:     2011-09-27 17:04:38 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
minor changes to interface code (no functional changes)
- made 2 loops on menu items break out of the loop when the item is found.
- include function names in error prints.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_handlers.c
    trunk/blender/source/blender/editors/interface/interface_icons.c
    trunk/blender/source/blender/editors/interface/interface_regions.c
    trunk/blender/source/blender/editors/interface/interface_style.c

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c	2011-09-27 16:45:04 UTC (rev 40623)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c	2011-09-27 17:04:38 UTC (rev 40624)
@@ -1684,7 +1684,7 @@
 			/* not a file?, strip non utf-8 chars */
 			if(strip) {
 				/* wont happen often so isnt that annoying to keep it here for a while */
-				printf("invalid utf8 - stripped chars %d\n", strip);
+				printf("%s: invalid utf8 - stripped chars %d\n", __func__, strip);
 			}
 		}
 		
@@ -5914,7 +5914,7 @@
 									ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
 								}
 								else {
-									printf("Error, but->menu_key type: %d\n", but->type);
+									printf("%s: error, but->menu_key type: %d\n", __func__, but->type);
 								}
 
 								break;

Modified: trunk/blender/source/blender/editors/interface/interface_icons.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_icons.c	2011-09-27 16:45:04 UTC (rev 40623)
+++ trunk/blender/source/blender/editors/interface/interface_icons.c	2011-09-27 17:04:38 UTC (rev 40624)
@@ -752,7 +752,7 @@
 	
 	if (icon==NULL) {
 		if (G.f & G_DEBUG)
-			printf("UI_icon_get_width: Internal error, no icon for icon ID: %d\n", icon_id);
+			printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
 		return 0;
 	}
 	
@@ -777,7 +777,7 @@
 	
 	if (icon==NULL) {
 		if (G.f & G_DEBUG)
-			printf("UI_icon_get_height: Internal error, no icon for icon ID: %d\n", icon_id);
+			printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
 		return 0;
 	}
 	
@@ -825,7 +825,7 @@
 
 	if (!prv_img) {
 		if (G.f & G_DEBUG)
-			printf("Error: requested preview image does not exist");
+			printf("%s, error: requested preview image does not exist", __func__);
 	}
 	if (!prv_img->rect[size]) {
 		prv_img->w[size] = render_size;
@@ -842,7 +842,7 @@
 {
 	if (!prv_img) {
 		if (G.f & G_DEBUG)
-			printf("No preview image for this ID: %s\n", id->name);
+			printf("%s: no preview image for this ID: %s\n", __func__, id->name);
 		return;
 	}	
 
@@ -858,7 +858,7 @@
 
 	/* sanity check */
 	if(w<=0 || h<=0 || w>2000 || h>2000) {
-		printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h);
+		printf("%s: icons are %i x %i pixels?\n", __func__, w, h);
 		BLI_assert(!"invalid icon size");
 		return;
 	}
@@ -948,7 +948,7 @@
 	return 0;
 }
 
-static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), int is_preview)
+static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
 {
 	Icon *icon = NULL;
 	DrawInfo *di = NULL;
@@ -960,7 +960,7 @@
 	
 	if (icon==NULL) {
 		if (G.f & G_DEBUG)
-			printf("icon_draw_mipmap: Internal error, no icon for icon ID: %d\n", icon_id);
+			printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
 		return;
 	}
 

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2011-09-27 16:45:04 UTC (rev 40623)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2011-09-27 17:04:38 UTC (rev 40624)
@@ -213,11 +213,13 @@
 				nicon= 0;
 			}
 			
-			if (c=='\0')
+			if (c=='\0') {
 				break;
-		} else if (!nitem)
+			}
+		} else if (!nitem) {
 			nitem= s;
-		
+		}
+
 		s++;
 	}
 	
@@ -233,6 +235,7 @@
 	for (i=0; i<md->nitems; i++) {
 		if (md->items[i].retval==value) {
 			BLI_strncpy(but->drawstr, md->items[i].str, sizeof(but->drawstr));
+			break;
 		}
 	}
 	
@@ -1647,11 +1650,12 @@
 	}
 
 	/* inconsistent, but menus with labels do not look good flipped */
-	for(a=0, b=0; a<md->nitems; a++, b++) {
-		entry= &md->items[a];
-
-		if(entry->sepr && entry->str[0])
+	entry= md->items;
+	for(a=0; a<md->nitems; a++, entry++) {
+		if(entry->sepr && entry->str[0]) {
 			block->flag |= UI_BLOCK_NO_FLIP;
+			break;
+		}
 	}
 
 	/* create items */
@@ -2555,7 +2559,7 @@
 	MenuType *mt= WM_menutype_find(idname, TRUE);
 
 	if(mt==NULL) {
-		printf("uiPupMenuInvoke: named menu \"%s\" not found\n", idname);
+		printf("%s: named menu \"%s\" not found\n", __func__, idname);
 		return;
 	}
 

Modified: trunk/blender/source/blender/editors/interface/interface_style.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_style.c	2011-09-27 16:45:04 UTC (rev 40623)
+++ trunk/blender/source/blender/editors/interface/interface_style.c	2011-09-27 17:04:38 UTC (rev 40624)
@@ -357,7 +357,7 @@
 
 		if (font->blf_id == -1) {
 			if (G.f & G_DEBUG)
-				printf("uiStyleInit error, no fonts available\n");
+				printf("%s: error, no fonts available\n", __func__);
 		}
 		else {
 			/* ? just for speed to initialize?




More information about the Bf-blender-cvs mailing list