diff options
Diffstat (limited to 'src/textfile_sub_source.hh')
-rw-r--r-- | src/textfile_sub_source.hh | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/src/textfile_sub_source.hh b/src/textfile_sub_source.hh index 724f7c7..e9b759e 100644 --- a/src/textfile_sub_source.hh +++ b/src/textfile_sub_source.hh @@ -36,19 +36,19 @@ #include "filter_observer.hh" #include "logfile.hh" #include "plain_text_source.hh" +#include "text_overlay_menu.hh" #include "textview_curses.hh" class textfile_sub_source : public text_sub_source , public vis_location_history + , public text_accel_source , public text_anchors { public: using file_iterator = std::deque<std::shared_ptr<logfile>>::iterator; textfile_sub_source() { this->tss_supports_filtering = true; } - ~textfile_sub_source() override = default; - bool empty() const { return this->tss_files.empty(); } size_t size() const { return this->tss_files.size(); } @@ -109,16 +109,24 @@ public: class scan_callback { public: + virtual ~scan_callback() = default; + virtual void closed_files( const std::vector<std::shared_ptr<logfile>>& files) = 0; virtual void promote_file(const std::shared_ptr<logfile>& lf) = 0; virtual void scanned_file(const std::shared_ptr<logfile>& lf) = 0; + virtual void renamed_file(const std::shared_ptr<logfile>& lf) = 0; }; - bool rescan_files(scan_callback& callback, - nonstd::optional<ui_clock::time_point> deadline - = nonstd::nullopt); + struct rescan_result_t { + size_t rr_new_data{0}; + bool rr_scan_completed{true}; + }; + + rescan_result_t rescan_files(scan_callback& callback, + nonstd::optional<ui_clock::time_point> deadline + = nonstd::nullopt); void text_filters_changed() override; @@ -140,10 +148,27 @@ public: nonstd::optional<std::string> anchor_for_row(vis_line_t vl) override; + nonstd::optional<vis_line_t> adjacent_anchor(vis_line_t vl, + direction dir) override; + std::unordered_set<std::string> get_anchors() override; void quiesce() override; + bool is_time_offset_supported() const override + { + const auto lf = this->current_file(); + if (lf != nullptr && lf->has_line_metadata()) { + return true; + } + + return false; + } + + logline* text_accel_get_line(vis_line_t vl) override; + + void scroll_invoked(textview_curses* tc) override; + private: void detach_observer(std::shared_ptr<logfile> lf) { @@ -168,6 +193,23 @@ private: std::deque<std::shared_ptr<logfile>> tss_hidden_files; std::unordered_map<std::string, rendered_file> tss_rendered_files; std::unordered_map<std::string, metadata_state> tss_doc_metadata; + size_t tss_line_indent_size{0}; + bool tss_completed_last_scan{true}; + attr_line_t tss_hex_line; + int64_t tss_content_line{0}; +}; + +class textfile_header_overlay : public text_overlay_menu { +public: + explicit textfile_header_overlay(textfile_sub_source* src); + + bool list_static_overlay(const listview_curses& lv, + int y, + int bottom, + attr_line_t& value_out) override; + +private: + textfile_sub_source* tho_src; }; #endif |