[asterisk-commits] branch russell/menuselect_buildoptions r34127 - /team/russell/menuselect_buil...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jun 14 08:15:32 MST 2006


Author: russell
Date: Wed Jun 14 10:15:31 2006
New Revision: 34127

URL: http://svn.digium.com/view/asterisk?rev=34127&view=rev
Log:
commit buggy and incomplete interface changes so i don't lose them

Modified:
    team/russell/menuselect_buildoptions/build_tools/menuselect.c
    team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c

Modified: team/russell/menuselect_buildoptions/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/russell/menuselect_buildoptions/build_tools/menuselect.c?rev=34127&r1=34126&r2=34127&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/build_tools/menuselect.c (original)
+++ team/russell/menuselect_buildoptions/build_tools/menuselect.c Wed Jun 14 10:15:31 2006
@@ -408,10 +408,19 @@
 void toggle_enabled(struct category *cat, int index)
 {
 	struct member *mem;
+	struct buildopt *bop;
 	int i = 0;
 
 	AST_LIST_TRAVERSE(&cat->members, mem, list) {
-		if (i++ == index)
+		AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
+			if (i++ == index) {
+				mem = NULL;
+				break;
+			}
+		}
+		if (!mem)
+			break;
+		else if (i++ == index)
 			break;
 	}
 
@@ -419,6 +428,9 @@
 		mem->enabled = !mem->enabled;
 		if (cat->force_clean_on_change)
 			force_clean = 1;
+	} else if (bop) {
+		bop->enabled = !bop->enabled;
+		force_clean = 1;
 	}
 }
 
@@ -607,10 +619,14 @@
 int count_members(struct category *cat)
 {
 	struct member *mem;
+	struct buildopt *bop;
 	int count = 0;
 
-	AST_LIST_TRAVERSE(&cat->members, mem, list)
+	AST_LIST_TRAVERSE(&cat->members, mem, list) {
 		count++;
+		AST_LIST_TRAVERSE(&mem->buildopts, bop, list)
+			count++;
+	}
 
 	return count;		
 }

Modified: team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c
URL: http://svn.digium.com/view/asterisk/team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c?rev=34127&r1=34126&r2=34127&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c (original)
+++ team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c Wed Jun 14 10:15:31 2006
@@ -156,9 +156,10 @@
 
 static void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed)
 {
-	int i = 0;
-	int j = 0;
+	int memnum = 0;
+	int linenum = 0;
 	struct member *mem;
+	struct buildopt *bop;
 	char buf[64];
 	const char *desc = NULL;
 
@@ -166,8 +167,10 @@
 		/* If all we have to do is move the cursor, 
 		 * then don't clear the screen and start over */
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
-			i++;
-			if (curopt + 1 == i) {
+			memnum++;
+			AST_LIST_TRAVERSE(&mem->buildopts, bop, list)
+				memnum++;
+			if (curopt + 1 <= memnum) {
 				display_mem_info(menu, mem, start, end);
 				break;
 			}
@@ -179,24 +182,36 @@
 
 	wclear(menu);
 
-	i = 0;
+	memnum = 0;
 	AST_LIST_TRAVERSE(&cat->members, mem, list) {
-		if (i < start) {
-			i++;
+		if (memnum < start) {
+			memnum++;
 			continue;
 		}
-		wmove(menu, j++, max_x / 2 - 10);
-		i++;
-		if (mem->depsfailed)
-			snprintf(buf, sizeof(buf), "XXX %d.%s %s", i, i < 10 ? " " : "", mem->name);
-		else
-			snprintf(buf, sizeof(buf), "[%s] %d.%s %s", mem->enabled ? "*" : " ", i, i < 10 ? " " : "", mem->name);
+		wmove(menu, linenum++, max_x / 2 - 10);
+		memnum++;
+		if (mem->depsfailed) {
+			snprintf(buf, sizeof(buf), "XXX %d.%s %s", 
+				memnum, memnum < 10 ? " " : "", mem->name);
+		} else {
+			snprintf(buf, sizeof(buf), "[%s] %d.%s %s", 
+				mem->enabled ? "*" : " ", memnum, memnum < 10 ? " " : "", mem->name);
+		}
 		waddstr(menu, buf);
-		
-		if (curopt + 1 == i)
+
+		AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
+			memnum++;
+			snprintf(buf, sizeof(buf), "        <%s> %s", bop->enabled ? "*" : " ", bop->name);
+			wmove(menu, linenum++, max_x / 2 - 10);
+			waddstr(menu, buf);
+			if (memnum == end)
+				break;
+		}
+
+		if (curopt + 1 <= memnum)
 			display_mem_info(menu, mem, start, end);
 
-		if (i == end)
+		if (memnum == end)
 			break;
 	}
 



More information about the asterisk-commits mailing list