From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id BF5B01387C2 for ; Fri, 1 Feb 2013 10:50:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1540C21C050; Fri, 1 Feb 2013 10:49:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 45E6021C048 for ; Fri, 1 Feb 2013 10:49:53 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0DB6E33DCB4 for ; Fri, 1 Feb 2013 10:49:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id E2079E409B for ; Fri, 1 Feb 2013 10:49:49 +0000 (UTC) From: "Sven Eden" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Eden" Message-ID: <1359656528.1bdb819de722aba94ecbde8c56d7f14a4b76104d.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: ufed-curses.h X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: 1bdb819de722aba94ecbde8c56d7f14a4b76104d X-VCS-Branch: master Date: Fri, 1 Feb 2013 10:49:49 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 05b4453f-c6f0-45a6-9614-a6c1ee9709b1 X-Archives-Hash: 70d6ebe76e3137db10f8c8ae11bebe6a commit: 1bdb819de722aba94ecbde8c56d7f14a4b76104d Author: Sven Eden gmx de> AuthorDate: Thu Jan 31 18:22:08 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Thu Jan 31 18:22:08 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=1bdb819d Removed now obsolete type definitions as they are moved to ufed-curses-types.h. Further added some fucntion prototypes to draw various aspects of the display on demand. --- ufed-curses.h | 86 +++++++++++--------------------------------------------- 1 files changed, 17 insertions(+), 69 deletions(-) diff --git a/ufed-curses.h b/ufed-curses.h index 3ef4a24..f996d7c 100644 --- a/ufed-curses.h +++ b/ufed-curses.h @@ -1,84 +1,32 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - - -/* debugging macros */ -#define DEBUG_EXIT 1 -#undef DEBUG_TRACE - -#if defined(DEBUG_EXIT) -# define ERROR_EXIT(code, fmt, ...) { \ - cursesdone(); \ - fprintf(stderr, "\nERROR in %s:%d (%s): \n -> ", \ - __FILE__, __LINE__, __FUNCTION__); \ - fprintf(stderr, fmt, __VA_ARGS__); \ - exit(code); \ -} -#else -# define ERROR_EXIT(code, ...) { cursesdone(); exit(code); } -#endif // DEBUG_EXIT -#if defined(DEBUG_TRACE) -# define TRACE { \ - fprintf(stderr, "(TRACE) %s:%d - %s\n", __FILE__, __LINE__, __FUNCTION__); \ -} -#else -# define TRACE -#endif // DEBUG_TRACE - - -/* global types */ -enum win { Top, Left, List, Input, Scrollbar, Right, Bottom, wCount }; -enum mask { show_unmasked, show_both, show_masked }; -enum order { pkgs_left, pkgs_right }; -enum scope { show_all, show_global, show_local }; - -struct window { - WINDOW *win; - const int top, left, height, width; -}; - -struct item { - struct item *prev, *next; - int currline; //!< the current line on the screen this item starts. - int listline; //!< the fixed line within the full list this item starts - int ndescr; //!< number of description lines - bool isMasked; - bool isGlobal; -}; - -struct key { - int key; - const char *descr; - size_t length; -}; +#include "ufed-curses-types.h" +/* global members */ +extern sWindow window[wCount]; /* global prototypes */ void cursesdone(void); -int getItemHeight(struct item *item); void initcurses(void); -bool isLegalItem(struct item *item); int maineventloop( const char *subtitle, - int (*callback)(struct item **currentitem, int key), - int (*drawitem)(struct item *item, bool highlight), - struct item *items, - const struct key *keys); -void drawitems(void); + int (*callback)(sFlag** curr, int key), + int (*drawflag)(sFlag* flag, bool highlight), + sFlag* flags, + const sKey* keys, + bool withSep); +void drawBottom(bool withSep); +void drawFlags(void); +void drawStatus(bool withSep); +void drawTop(bool withSep); bool scrollcurrent(void); bool yesno(const char *); /* global inline functions */ -extern struct window window[wCount]; -static inline WINDOW *win(enum win w) { return window[w].win; } -static inline int wTop (enum win w) { return (window[w].top >= 0 ? 0 : LINES) + window[w].top ; } -static inline int wLeft (enum win w) { return (window[w].left >= 0 ? 0 : COLS ) + window[w].left ; } -static inline int wHeight(enum win w) { return (window[w].height > 0 ? 0 : LINES) + window[w].height; } -static inline int wWidth (enum win w) { return (window[w].width > 0 ? 0 : COLS ) + window[w].width ; } +static inline WINDOW *win(eWin w) { return window[w].win; } +static inline int wTop (eWin w) { return (window[w].top >= 0 ? 0 : LINES) + window[w].top ; } +static inline int wLeft (eWin w) { return (window[w].left >= 0 ? 0 : COLS ) + window[w].left ; } +static inline int wHeight(eWin w) { return (window[w].height > 0 ? 0 : LINES) + window[w].height; } +static inline int wWidth (eWin w) { return (window[w].width > 0 ? 0 : COLS ) + window[w].width ; } static inline int min(int a, int b) { return a < b ? a : b; } static inline int max(int a, int b) { return a > b ? a : b; }