add indication for people with subtrees
This commit is contained in:
+29
-12
@@ -90,10 +90,29 @@ static U16 Utf8SymbolsCount(const string& str)
|
||||
return num;
|
||||
}
|
||||
|
||||
U16 Person::draw(const I16 drawY, const I16 drawX, bool selected, bool hasSpouse,
|
||||
bool hasParents, bool hasKids, bool wholeName) const
|
||||
U16 Person::drawAsFocused(const I16 drawY, const I16 drawX, bool selected, bool hasSpouse,
|
||||
bool hasKids, bool wholeName) const
|
||||
{
|
||||
string display_name; /* todo remove? */
|
||||
auto topright = hasSpouse ? ACS_TTEE : ACS_URCORNER;
|
||||
auto botleft = hasKids ? ACS_LTEE : ACS_LLCORNER;
|
||||
|
||||
return draw(drawY, drawX, selected, wholeName,
|
||||
ACS_LTEE, topright,
|
||||
botleft, ACS_LRCORNER );
|
||||
}
|
||||
|
||||
U16 Person::drawAsSpouse(I16 drawY, I16 drawX, bool selected, bool hasTree, bool wholeName) const
|
||||
{
|
||||
auto topright = hasTree ? '@' : ACS_URCORNER;
|
||||
return draw(drawY, drawX, selected, wholeName,
|
||||
ACS_TTEE, topright,
|
||||
ACS_LLCORNER, ACS_LRCORNER );
|
||||
}
|
||||
|
||||
U16 Person::draw(I16 drawY, I16 drawX, bool selected, bool wholeName,
|
||||
U32 topleft, U32 topright, U32 botleft, U32 botright) const
|
||||
{
|
||||
string display_name;
|
||||
if(wholeName)
|
||||
{
|
||||
display_name = name;
|
||||
@@ -103,9 +122,7 @@ U16 Person::draw(const I16 drawY, const I16 drawX, bool selected, bool hasSpouse
|
||||
size_t space = name.find(' ');
|
||||
if(space != string::npos)
|
||||
{
|
||||
/* name[space] = '\0'; */
|
||||
display_name = name.substr(0, space);
|
||||
/* name[space] = ' '; */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -113,24 +130,23 @@ U16 Person::draw(const I16 drawY, const I16 drawX, bool selected, bool hasSpouse
|
||||
}
|
||||
}
|
||||
|
||||
const U16 width = Utf8SymbolsCount(display_name) + 4; /* pad width */
|
||||
|
||||
/* pad width */
|
||||
const U16 width = Utf8SymbolsCount(display_name) + 4;
|
||||
|
||||
if(willBeVisible(drawY, drawX, BOX_HEIGHT, width))
|
||||
{
|
||||
AutoWin pad( newpad(BOX_HEIGHT, width) );
|
||||
|
||||
auto color_pair = COLOR_PAIR( selected ? COLOR_SELECTED
|
||||
: (sex==M ? COLOR_MALE : COLOR_FEMALE) );
|
||||
: (sex==M ? COLOR_MALE : COLOR_FEMALE) );
|
||||
|
||||
wbkgd(pad, color_pair);
|
||||
/* wattron(pad, color_pair); */
|
||||
|
||||
auto top_left = hasParents ? ACS_LTEE : ACS_TTEE;
|
||||
auto top_right = hasSpouse ? ACS_TTEE : ACS_URCORNER;
|
||||
auto bot_left = hasKids ? ACS_LTEE : ACS_LLCORNER;
|
||||
wborder(pad, ACS_VLINE, ACS_VLINE, ACS_HLINE, ACS_HLINE,
|
||||
top_left, top_right,
|
||||
bot_left, ACS_LRCORNER );
|
||||
topleft, topright,
|
||||
botleft, botright);
|
||||
|
||||
mvwaddstr(pad, 2, 2, display_name.data());
|
||||
|
||||
@@ -139,4 +155,5 @@ U16 Person::draw(const I16 drawY, const I16 drawX, bool selected, bool hasSpouse
|
||||
drawpad(pad, drawY, drawX);
|
||||
}
|
||||
return width;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user