From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH V2] Menu: add box style entry
Date: Thu, 16 Sep 2010 15:55:01 +0200 [thread overview]
Message-ID: <20100916135501.GW1473@pengutronix.de> (raw)
In-Reply-To: <20100916120956.GB5762@game.jcrosoft.org>
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.
Regards,
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2010-09-16 13:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-05 15:23 [PATCH] Menu: add box stype entry Jean-Christophe PLAGNIOL-VILLARD
2010-09-05 16:03 ` [PATCH V2] Menu: add box style entry Jean-Christophe PLAGNIOL-VILLARD
2010-09-16 10:53 ` Sascha Hauer
2010-09-16 12:09 ` Jean-Christophe PLAGNIOL-VILLARD
2010-09-16 13:55 ` Sascha Hauer [this message]
2010-09-16 16:00 ` Jean-Christophe PLAGNIOL-VILLARD
2010-09-06 15:21 Jean-Christophe PLAGNIOL-VILLARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100916135501.GW1473@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=plagnioj@jcrosoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox