summaryrefslogtreecommitdiff
path: root/src/viewer/mcviewer.h
blob: 29af9174d459248d83404b26a16519165aed3951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/** \file mcviewer.h
 *  \brief Header: internal file viewer
 */

#ifndef MC__VIEWER_H
#define MC__VIEWER_H

#include "lib/global.h"
#include "lib/widget.h"  // WRect

/*** typedefs(not structures) and defined constants **********************************************/

/*** enums ***************************************************************************************/

/*** structures declarations (and typedefs of structures)*****************************************/

struct WView;
typedef struct WView WView;

typedef struct
{
    gboolean wrap;   // Wrap text lines to fit them on the screen
    gboolean hex;    // Plainview or hexview
    gboolean magic;  // Preprocess the file using external programs
    gboolean nroff;  // Nroff-style highlighting
} mcview_mode_flags_t;

/*** global variables defined in .c file *********************************************************/

extern mcview_mode_flags_t mcview_global_flags;
extern mcview_mode_flags_t mcview_altered_flags;

extern gboolean mcview_remember_file_position;
extern int mcview_max_dirt_limit;

extern gboolean mcview_mouse_move_pages;
extern char *mcview_show_eof;

/*** declarations of public functions ************************************************************/

/* Creates a new WView object with the given properties. */
extern WView *mcview_new (const WRect *r, gboolean is_panel);

/* Shows {file} or the output of {command} in the internal viewer,
 * starting in line {start_line}.
 */
extern gboolean mcview_viewer (const char *command, const vfs_path_t *file_vpath, int start_line,
                               off_t search_start, off_t search_end);

extern gboolean mcview_load (WView *view, const char *command, const char *file, int start_line,
                             off_t search_start, off_t search_end);

extern void mcview_clear_mode_flags (mcview_mode_flags_t *flags);

/*** inline functions ****************************************************************************/
#endif