* Starting work on ElementText for displaying generic information.

* If a storage error was thrown from make_directory in
EntryList::open, it would try to erase a FileMeta that wasn't inserted.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@753 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-08-09 19:55:34 +00:00
parent ba28df3ff2
commit ca58b43d8b
17 changed files with 360 additions and 67 deletions
+16 -3
View File
@@ -51,20 +51,33 @@ TextElementList::clear() {
char*
TextElementList::print(char* first, const char* last, Canvas::attributes_list* attributes, void* object) {
int column = m_columnWidth != NULL ? m_column : 0;
// Call print for each element even if first == last so that any
// attributes gets added to the list.
for (iterator itr = begin(); itr != end(); ++itr)
first = (*itr)->print(first, last, attributes, object);
if (column-- > 0) {
const char* columnEnd = std::min<const char*>(last, first + *m_columnWidth);
first = (*itr)->print(first, columnEnd, attributes, object);
std::memset(first, ' ', columnEnd - first);
first += columnEnd - first;
} else {
first = (*itr)->print(first, last, attributes, object);
}
return first;
}
TextElementList::extent_type
TextElementList::max_length() {
size_type length = 0;
extent_type length = 0;
int column = m_columnWidth != NULL ? m_column : 0;
for (iterator itr = begin(); itr != end(); ++itr) {
size_type l = (*itr)->max_length();
extent_type l = column-- > 0 ? std::min((*itr)->max_length(), *m_columnWidth) : (*itr)->max_length();
if (l == extent_full)
return extent_full;