From patchwork Mon Jun 20 22:58:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 2096 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 1AA2123E52 for ; Mon, 20 Jun 2011 22:58:57 +0000 (UTC) Received: from mail-vx0-f180.google.com (mail-vx0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id E02F2A182CD for ; Mon, 20 Jun 2011 22:58:56 +0000 (UTC) Received: by mail-vx0-f180.google.com with SMTP id 7so2987210vxd.11 for ; Mon, 20 Jun 2011 15:58:56 -0700 (PDT) Received: by 10.52.161.65 with SMTP id xq1mr502416vdb.167.1308610736662; Mon, 20 Jun 2011 15:58:56 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.52.183.130 with SMTP id em2cs32808vdc; Mon, 20 Jun 2011 15:58:56 -0700 (PDT) Received: by 10.216.229.229 with SMTP id h79mr5236829weq.74.1308610734732; Mon, 20 Jun 2011 15:58:54 -0700 (PDT) Received: from smtp.smtpout.orange.fr (smtp03.smtpout.orange.fr [80.12.242.125]) by mx.google.com with ESMTP id o4si3558878weq.41.2011.06.20.15.58.54; Mon, 20 Jun 2011 15:58:54 -0700 (PDT) Received-SPF: neutral (google.com: 80.12.242.125 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=80.12.242.125; Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.125 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: from monster.dhcp.lxc ([92.134.95.191]) by mwinf5d06 with ME id yNyp1g00347kPVY03NytD7; Tue, 21 Jun 2011 00:58:54 +0200 From: Daniel Lezcano To: linaro-dev@lists.linaro.org Subject: [powerdebug 09/17] split header and footer display Date: Tue, 21 Jun 2011 00:58:17 +0200 Message-Id: <1308610705-23281-9-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1308610705-23281-1-git-send-email-daniel.lezcano@linaro.org> References: <1308610705-23281-1-git-send-email-daniel.lezcano@linaro.org> Splitting the header and the footer will help to display a new footer like the search string. Signed-off-by: Daniel Lezcano --- display.c | 28 +++++++++++++++++++++------- 1 files changed, 21 insertions(+), 7 deletions(-) diff --git a/display.c b/display.c index 758d17e..43f3797 100644 --- a/display.c +++ b/display.c @@ -41,9 +41,6 @@ static int current_win; /* Number of lines in the virtual window */ static const int maxrows = 1024; -#define footer_label " Q (Quit) R (Refresh) Other Keys: 'Left', " \ - "'Right' , 'Up', 'Down', 'enter', , 'Esc'" - struct rowdata { int attr; void *data; @@ -71,7 +68,7 @@ static void display_fini(void) endwin(); } -static int show_header_footer(int win) +static int display_show_header(int win) { int i; int curr_pointer = 0; @@ -94,8 +91,16 @@ static int show_header_footer(int win) curr_pointer += strlen(windata[i].name) + 2; } wrefresh(header_win); - werase(footer_win); + return 0; +} + +#define footer_label " Q (Quit) R (Refresh) Other Keys: 'Left', " \ + "'Right' , 'Up', 'Down', 'enter', , 'Esc'" + +static int display_show_footer(int win) +{ + werase(footer_win); wattron(footer_win, A_REVERSE); mvwprintw(footer_win, 0, 0, "%s", footer_label); wattroff(footer_win, A_REVERSE); @@ -415,7 +420,10 @@ int display_init(int wdefault) if (!footer_win) return -1; - if (show_header_footer(wdefault)) + if (display_show_header(wdefault)) + return -1; + + if (display_show_footer(wdefault)) return -1; return display_refresh(wdefault); @@ -423,13 +431,19 @@ int display_init(int wdefault) int display_header_footer(int win, const char *line) { + int ret; + werase(main_win); wattron(main_win, A_BOLD); mvwprintw(main_win, 0, 0, "%s", line); wattroff(main_win, A_BOLD); wrefresh(main_win); - return show_header_footer(win); + ret = display_show_header(win); + if (ret) + return ret; + + return display_show_footer(win); } int display_register(int win, struct display_ops *ops)