Re: [PATCH V2] Menu: add box style entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15:55 Thu 16 Sep     , Sascha Hauer wrote:
> On Thu, Sep 16, 2010 at 02:09:56PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > +		} else {
> > > > +			puts("   ");
> > > > +		}
> > > > +		printf(" %d: %-*s", me->num, m->width, me->display);
> > > > +	}
> > > 
> > > I think this could look a bit simpler if we had a
> > > static int printf_menu(int selected, const char *fmt, ...) function.
> > > 'selected' is a better name for the argument. with 'reverse' my first
> > > thought was that it prints backwards...
> > sorry I do not follow
> 
> The print_menu_entry would look simpler like this:
> 
> static void print_menu_entry(struct menu *m, struct menu_entry *me, int selected)
> {
> 	gotoXY(me->num + 1, 3);
> 
> 	if (selected)
> 		printf("\e[7m");
> 
> 	if (me->type == MENU_ENTRY_BOX) {
> 		if (me->box_state)
> 			printf("[*]");
> 		else
> 			printf("[ ]");
> 	} else {
> 		printf("   ");
> 	}
> 
> 	printf(" %d: %-*s", me->num, m->width, me->display);
> 
> 	if (selected)
> 		printf("\e[m");
> }
> 
> I was confused by the name of the printf_reverse macro. For me it was
> not clear what it should do without looking at the macro definition.
ok

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux