Gentoo Archives: gentoo-commits

From: Sven Eden <sven.eden@×××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/ufed:master commit in: /
Date: Fri, 01 Feb 2013 10:50:03
Message-Id: 1359656528.1bdb819de722aba94ecbde8c56d7f14a4b76104d.yamakuzure@gentoo
1 commit: 1bdb819de722aba94ecbde8c56d7f14a4b76104d
2 Author: Sven Eden <sven.eden <AT> gmx <DOT> de>
3 AuthorDate: Thu Jan 31 18:22:08 2013 +0000
4 Commit: Sven Eden <sven.eden <AT> gmx <DOT> de>
5 CommitDate: Thu Jan 31 18:22:08 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=1bdb819d
7
8 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.
9
10 ---
11 ufed-curses.h | 86 +++++++++++---------------------------------------------
12 1 files changed, 17 insertions(+), 69 deletions(-)
13
14 diff --git a/ufed-curses.h b/ufed-curses.h
15 index 3ef4a24..f996d7c 100644
16 --- a/ufed-curses.h
17 +++ b/ufed-curses.h
18 @@ -1,84 +1,32 @@
19 -#ifdef HAVE_CONFIG_H
20 -#include "config.h"
21 -#endif
22 -
23 -#include <curses.h>
24 -
25 -
26 -/* debugging macros */
27 -#define DEBUG_EXIT 1
28 -#undef DEBUG_TRACE
29 -
30 -#if defined(DEBUG_EXIT)
31 -# define ERROR_EXIT(code, fmt, ...) { \
32 - cursesdone(); \
33 - fprintf(stderr, "\nERROR in %s:%d (%s): \n -> ", \
34 - __FILE__, __LINE__, __FUNCTION__); \
35 - fprintf(stderr, fmt, __VA_ARGS__); \
36 - exit(code); \
37 -}
38 -#else
39 -# define ERROR_EXIT(code, ...) { cursesdone(); exit(code); }
40 -#endif // DEBUG_EXIT
41 -#if defined(DEBUG_TRACE)
42 -# define TRACE { \
43 - fprintf(stderr, "(TRACE) %s:%d - %s\n", __FILE__, __LINE__, __FUNCTION__); \
44 -}
45 -#else
46 -# define TRACE
47 -#endif // DEBUG_TRACE
48 -
49 -
50 -/* global types */
51 -enum win { Top, Left, List, Input, Scrollbar, Right, Bottom, wCount };
52 -enum mask { show_unmasked, show_both, show_masked };
53 -enum order { pkgs_left, pkgs_right };
54 -enum scope { show_all, show_global, show_local };
55 -
56 -struct window {
57 - WINDOW *win;
58 - const int top, left, height, width;
59 -};
60 -
61 -struct item {
62 - struct item *prev, *next;
63 - int currline; //!< the current line on the screen this item starts.
64 - int listline; //!< the fixed line within the full list this item starts
65 - int ndescr; //!< number of description lines
66 - bool isMasked;
67 - bool isGlobal;
68 -};
69 -
70 -struct key {
71 - int key;
72 - const char *descr;
73 - size_t length;
74 -};
75 +#include "ufed-curses-types.h"
76
77 +/* global members */
78 +extern sWindow window[wCount];
79
80 /* global prototypes */
81 void cursesdone(void);
82 -int getItemHeight(struct item *item);
83 void initcurses(void);
84 -bool isLegalItem(struct item *item);
85
86 int maineventloop(
87 const char *subtitle,
88 - int (*callback)(struct item **currentitem, int key),
89 - int (*drawitem)(struct item *item, bool highlight),
90 - struct item *items,
91 - const struct key *keys);
92 -void drawitems(void);
93 + int (*callback)(sFlag** curr, int key),
94 + int (*drawflag)(sFlag* flag, bool highlight),
95 + sFlag* flags,
96 + const sKey* keys,
97 + bool withSep);
98 +void drawBottom(bool withSep);
99 +void drawFlags(void);
100 +void drawStatus(bool withSep);
101 +void drawTop(bool withSep);
102 bool scrollcurrent(void);
103 bool yesno(const char *);
104
105
106 /* global inline functions */
107 -extern struct window window[wCount];
108 -static inline WINDOW *win(enum win w) { return window[w].win; }
109 -static inline int wTop (enum win w) { return (window[w].top >= 0 ? 0 : LINES) + window[w].top ; }
110 -static inline int wLeft (enum win w) { return (window[w].left >= 0 ? 0 : COLS ) + window[w].left ; }
111 -static inline int wHeight(enum win w) { return (window[w].height > 0 ? 0 : LINES) + window[w].height; }
112 -static inline int wWidth (enum win w) { return (window[w].width > 0 ? 0 : COLS ) + window[w].width ; }
113 +static inline WINDOW *win(eWin w) { return window[w].win; }
114 +static inline int wTop (eWin w) { return (window[w].top >= 0 ? 0 : LINES) + window[w].top ; }
115 +static inline int wLeft (eWin w) { return (window[w].left >= 0 ? 0 : COLS ) + window[w].left ; }
116 +static inline int wHeight(eWin w) { return (window[w].height > 0 ? 0 : LINES) + window[w].height; }
117 +static inline int wWidth (eWin w) { return (window[w].width > 0 ? 0 : COLS ) + window[w].width ; }
118 static inline int min(int a, int b) { return a < b ? a : b; }
119 static inline int max(int a, int b) { return a > b ? a : b; }