25 #ifndef GOBY_UTIL_DEBUG_LOGGER_FLEX_NCURSES_H
26 #define GOBY_UTIL_DEBUG_LOGGER_FLEX_NCURSES_H
34 #include <boost/date_time/posix_time/ptime.hpp>
88 void putline(
const std::string& s,
unsigned scrn,
bool refresh =
true);
90 void putlines(
unsigned scrn,
91 const std::multimap<boost::posix_time::ptime, std::string>::const_iterator& alpha,
92 const std::multimap<boost::posix_time::ptime, std::string>::const_iterator& omega,
97 size_t find_containing_window(
int y,
int x);
100 bool in_window(
void* p,
int y,
int x);
102 void write_head_title(
size_t i);
105 void select(
size_t gt);
109 size_t down() {
return down(find_first_selected()); }
110 size_t up() {
return up(find_first_selected()); }
111 size_t left() {
return left(find_first_selected()); }
112 size_t right() {
return right(find_first_selected()); }
113 size_t down(
size_t curr);
114 size_t up(
size_t curr);
115 size_t left(
size_t curr);
116 size_t right(
size_t curr);
117 size_t find_first_selected();
118 void shift(
size_t next);
120 bool last_in_col(
size_t val);
121 bool first_in_col(
size_t val);
129 void uncombine_all();
130 void uncombine(
size_t i);
131 void uncombine_selected();
132 int lines_from_beg(
int l,
size_t i);
149 void restore_order();
151 void toggle_minimized(
int i);
152 void redraw_lines(
int j,
int offset = -1);
154 std::multimap<boost::posix_time::ptime, std::string> get_history(
size_t i,
int how_much = -1);
155 size_t get_history_size(
size_t i);
157 template <
typename T> T min(
const T& a,
const T& b) {
return (a < b ? a : b); }
159 template <
typename T> T max(
const T& a,
const T& b) {
return (a > b ? a : b); }
172 std::vector<void*> vert_windows_;
174 std::vector<void*> col_end_windows_;
175 void* foot_window_{
nullptr};
177 bool is_locked_{
false};
178 int locked_panel_{0};
183 Panel(
const logger::Group*
group =
nullptr) : group_(
group) {}
185 void window(
void* v) { window_ = v; }
186 void head_window(
void* v) { head_window_ = v; }
187 void group(
const logger::Group* g) { group_ = g; }
189 void set_minimized(
bool b) { minimized_ = b; }
190 int minimized(
bool b);
191 int toggle_minimized() {
return minimized(minimized() ^
true); }
192 void selected(
bool b) { selected_ = b; }
193 void ywidth(
int i) { ywidth_ = i; }
194 int lines_from_beg(
int i);
195 void grow() { ++ywidth_; }
196 void locked(
bool b) { locked_ = b; }
199 if (ywidth_ == HEAD_Y)
207 void col(
int i) { col_ = i; }
208 void original_order(
int i) { original_order_ = i; }
209 void add_combined(
size_t i) { combined_.insert(i); }
210 void clear_combined() { combined_.clear(); }
212 void* window()
const {
return window_; }
213 void* head_window()
const {
return head_window_; }
214 const logger::Group*
group()
const {
return group_; }
215 bool minimized()
const {
return minimized_; }
216 bool selected()
const {
return selected_; }
217 int ywidth()
const {
return ywidth_; }
218 int col()
const {
return col_; }
219 bool locked()
const {
return locked_; }
220 int lines_from_beg()
const {
return lines_from_beg_; }
221 int original_order()
const {
return original_order_; }
222 std::multimap<boost::posix_time::ptime, std::string>& history() {
return history_; }
223 unsigned max_hist()
const {
return max_hist_; }
224 const std::set<size_t>& combined()
const {
return combined_; }
227 const logger::Group* group_;
228 void* window_{
nullptr};
229 void* head_window_{
nullptr};
230 bool minimized_{
false};
231 bool selected_{
false};
234 int unminimized_ywidth_;
236 int lines_from_beg_{0};
237 int original_order_{0};
238 unsigned max_hist_{20000};
239 std::multimap<boost::posix_time::ptime, std::string> history_;
240 std::set<size_t> combined_;
243 std::vector<Panel> panels_;
244 std::set<size_t> unique_panels_;
248 std::vector<int> line_buffer_;