From 2e9baa1635d107716b239a8f175766e5a085949e Mon Sep 17 00:00:00 2001 From: rakshasa Date: Wed, 6 Nov 2013 23:23:20 +0900 Subject: [PATCH] Added logging of some ui events. --- src/input/path_input.cc | 5 +++++ src/ui/element_string_list.cc | 7 +++++++ src/ui/element_string_list.h | 21 +++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/input/path_input.cc b/src/input/path_input.cc index 04b22f17..461d850f 100644 --- a/src/input/path_input.cc +++ b/src/input/path_input.cc @@ -42,6 +42,7 @@ #include #include +#include #ifdef __sun__ #include @@ -90,6 +91,8 @@ struct _transform_filename { void PathInput::receive_do_complete() { + lt_log_print(torrent::LOG_UI_EVENTS, "path_input: received completion"); + size_type dirEnd = find_last_delim(); utils::Directory dir(dirEnd != 0 ? str().substr(0, dirEnd) : "./"); @@ -123,6 +126,8 @@ PathInput::receive_do_complete() { m_showNext = ++utils::Directory::iterator(r.first) != r.second; if (m_showNext) { + lt_log_print(torrent::LOG_UI_EVENTS, "path_input: show next page"); + for (signal_itr_itr::iterator itr = m_signal_show_range.begin(), last = m_signal_show_range.end(); itr != last; itr++) (*itr)(r.first, r.second); } diff --git a/src/ui/element_string_list.cc b/src/ui/element_string_list.cc index f57b3f97..79f1adf2 100644 --- a/src/ui/element_string_list.cc +++ b/src/ui/element_string_list.cc @@ -55,6 +55,8 @@ ElementStringList::activate(display::Frame* frame, bool focus) { if (is_active()) throw torrent::internal_error("ui::ElementStringList::activate(...) is_active()."); + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: activate"); + control->input()->push_back(&m_bindings); m_window = new WStringList(); @@ -69,6 +71,8 @@ ElementStringList::disable() { if (!is_active()) throw torrent::internal_error("ui::ElementStringList::disable(...) !is_active()."); + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: deactivate"); + control->input()->erase(&m_bindings); m_frame->clear(); @@ -80,6 +84,9 @@ ElementStringList::disable() { void ElementStringList::next_screen() { + if (m_window == NULL) + return; + if (m_window->get_draw_end() != m_list.end()) m_window->set_range(m_window->get_draw_end(), m_list.end()); else diff --git a/src/ui/element_string_list.h b/src/ui/element_string_list.h index fcd4b749..e034988b 100644 --- a/src/ui/element_string_list.h +++ b/src/ui/element_string_list.h @@ -41,6 +41,7 @@ #include #include #include +#include #include "element_base.h" @@ -69,8 +70,14 @@ public: while (first != last) m_list.push_back(*(first++)); - m_window->set_range(m_list.begin(), m_list.end()); - m_window->mark_dirty(); + if (m_window != NULL) { + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: set range (visible)"); + + m_window->set_range(m_list.begin(), m_list.end()); + m_window->mark_dirty(); + } else { + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: set range (hidden)"); + } } // A hack, clean this up. @@ -81,8 +88,14 @@ public: while (first != last) m_list.push_back((first++)->d_name); - m_window->set_range(m_list.begin(), m_list.end()); - m_window->mark_dirty(); + if (m_window != NULL) { + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: set dirent range (visible)"); + + m_window->set_range(m_list.begin(), m_list.end()); + m_window->mark_dirty(); + } else { + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: set dirent range (hidden)"); + } } void next_screen();