From e719cd6eba23381b663bb57e176769cf371712b7 Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Thu, 12 Sep 2013 15:37:57 +0200 Subject: sWrap_: new struct to support description line wrapping --- ufed-curses-types.c | 4 ++++ ufed-curses-types.h | 36 ++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/ufed-curses-types.c b/ufed-curses-types.c index 10504cf..a09336b 100644 --- a/ufed-curses-types.c +++ b/ufed-curses-types.c @@ -63,6 +63,10 @@ sFlag* addFlag (sFlag** root, const char* name, int line, int ndesc, const char newFlag->desc[i].stateForced = ' '; newFlag->desc[i].stateMasked = ' '; newFlag->desc[i].statePackage = ' '; + newFlag->desc[i].wrap = NULL; + newFlag->desc[i].wrapOrder = e_order; + newFlag->desc[i].wrapStripped = e_desc; + newFlag->desc[i].wrapWidth = 0; } } else ERROR_EXIT(-1, "Unable to allocate %lu bytes for %d sDesc_ structs\n", diff --git a/ufed-curses-types.h b/ufed-curses-types.h index e53a58c..33b94a1 100644 --- a/ufed-curses-types.h +++ b/ufed-curses-types.h @@ -100,20 +100,36 @@ typedef enum eWin_ { * =============== */ + +/** @struct sWrap_ + * @brief Describe one start and length of a wrapped description line +**/ +typedef struct sWrap_ { + size_t len; //!< Length of the wrapped line part + size_t pos; //!< Starting position of a wrapped line part + struct + sWrap_* next; //!< Next part of the wrapped line +} sWrap; + /** @struct sDesc_ * @brief Describe one description line **/ typedef struct sDesc_ { - char* desc; //!< The description line - char* desc_alt; //!< The alternative description line - bool isGlobal; //!< true if this is the global description and setting - bool isInstalled; //!< global: at least one pkg is installed, local: all in *pkg are installed. - char* pkg; //!< affected packages - char stateForced; //!< unforced '-', forced '+' or not set ' ' by *use.force - char stateMasked; //!< unmasked '-', masked '+' or not sed ' ' by *use.mask - char stateDefault; //!< disabled '-', enabled '+' or not set ' ' ebuilds IUSE (installed packages only) - char statePackage; //!< disabled '-', enabled '+' or not set ' ' by profiles package.use - char statePkgUse; //!< disabled '-', enabled '+' or not set ' ' by users package.use + char* desc; //!< The description line + char* desc_alt; //!< The alternative description line + bool isGlobal; //!< true if this is the global description and setting + bool isInstalled; //!< global: at least one pkg is installed, local: all in *pkg are installed. + char* pkg; //!< affected packages + char stateForced; //!< unforced '-', forced '+' or not set ' ' by *use.force + char stateMasked; //!< unmasked '-', masked '+' or not sed ' ' by *use.mask + char stateDefault; //!< disabled '-', enabled '+' or not set ' ' ebuilds IUSE (installed packages only) + char statePackage; //!< disabled '-', enabled '+' or not set ' ' by profiles package.use + char statePkgUse; //!< disabled '-', enabled '+' or not set ' ' by users package.use + sWrap* wrap; //!< If lines are wrapped, this list describes the parts + int wrapCount; //!< How many parts there are. + eOrder wrapOrder; //!< State of e_order when the wrap parts were calculated last + eDesc wrapStripped; //!< State of e_desc when the wrap parts were calculated last + size_t wrapWidth; //!< The width available the wrap parts are calculated from } sDesc; -- cgit v1.2.3-65-gdbad