1 /** 2 * Copyright (c) 2020, Timothy Stack 3 * 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * 9 * * Redistributions of source code must retain the above copyright notice, this 10 * list of conditions and the following disclaimer. 11 * * Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * * Neither the name of Timothy Stack nor the names of its contributors 15 * may be used to endorse or promote products derived from this software 16 * without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY 19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * @file view_helpers.hh 30 */ 31 32 #ifndef lnav_view_helpers_hh 33 #define lnav_view_helpers_hh 34 35 #include "help_text.hh" 36 #include "attr_line.hh" 37 #include "vis_line.hh" 38 #include "bookmarks.hh" 39 40 class textview_curses; 41 42 /** The different views available. */ 43 typedef enum { 44 LNV_LOG, 45 LNV_TEXT, 46 LNV_HELP, 47 LNV_HISTOGRAM, 48 LNV_DB, 49 LNV_SCHEMA, 50 LNV_PRETTY, 51 LNV_SPECTRO, 52 53 LNV__MAX 54 } lnav_view_t; 55 56 extern const char *lnav_view_strings[LNV__MAX + 1]; 57 58 nonstd::optional<lnav_view_t> view_from_string(const char *name); 59 60 bool ensure_view(textview_curses *expected_tc); 61 bool toggle_view(textview_curses *toggle_tc); 62 void layout_views(); 63 64 void execute_examples(); 65 attr_line_t eval_example(const help_text &ht, const help_example &ex); 66 67 nonstd::optional<vis_line_t> next_cluster( 68 vis_line_t(bookmark_vector<vis_line_t>::*f) (vis_line_t) const, 69 bookmark_type_t *bt, 70 vis_line_t top); 71 bool moveto_cluster(vis_line_t(bookmark_vector<vis_line_t>::*f) (vis_line_t) const, 72 bookmark_type_t *bt, 73 vis_line_t top); 74 void previous_cluster(bookmark_type_t *bt, textview_curses *tc); 75 vis_line_t search_forward_from(textview_curses *tc); 76 77 #endif 78