1 #ifndef MC_VIEWER_INTERNAL_H
2 #define MC_VIEWER_INTERNAL_H
4 #include "../src/widget.h"
5 #include "../src/search/search.h"
7 /*** typedefs(not structures) and defined constants ********************/
9 typedef unsigned char byte
;
11 /* A width or height on the screen */
12 typedef unsigned int screen_dimen
;
14 /* Offset in bytes into a file */
15 typedef unsigned long offset_type
;
17 /*** enums *************************************************************/
19 /* data sources of the view */
21 DS_NONE
, /* No data available */
22 DS_STDIO_PIPE
, /* Data comes from a pipe using popen/pclose */
23 DS_VFS_PIPE
, /* Data comes from a piped-in VFS file */
24 DS_FILE
, /* Data comes from a VFS file */
25 DS_STRING
/* Data comes from a string in memory */
28 /*** structures declarations (and typedefs of structures)***************/
31 screen_dimen top
, left
;
32 screen_dimen height
, width
;
39 char *filename
; /* Name of the file */
40 char *command
; /* Command used to pipe data in */
42 enum view_ds datasource
; /* Where the displayed data comes from */
44 /* stdio pipe data source */
45 FILE *ds_stdio_pipe
; /* Output of a shell command */
47 /* vfs pipe data source */
48 int ds_vfs_pipe
; /* Non-seekable vfs file descriptor */
50 /* vfs file data source */
51 int ds_file_fd
; /* File with random access */
52 off_t ds_file_filesize
; /* Size of the file */
53 off_t ds_file_offset
; /* Offset of the currently loaded data */
54 byte
*ds_file_data
; /* Currently loaded data */
55 size_t ds_file_datalen
; /* Number of valid bytes in file_data */
56 size_t ds_file_datasize
; /* Number of allocated bytes in file_data */
58 /* string data source */
59 byte
*ds_string_data
; /* The characters of the string */
60 size_t ds_string_len
; /* The length of the string */
62 /* Growing buffers information */
63 gboolean growbuf_in_use
; /* Use the growing buffers? */
64 byte
**growbuf_blockptr
; /* Pointer to the block pointers */
65 size_t growbuf_blocks
; /* The number of blocks in *block_ptr */
66 size_t growbuf_lastindex
; /* Number of bytes in the last page of the
68 gboolean growbuf_finished
; /* TRUE when all data has been read. */
71 gboolean hex_mode
; /* Hexview or Hexedit */
72 gboolean hexedit_mode
; /* Hexedit */
73 gboolean hexview_in_text
; /* Is the hexview cursor in the text area? */
74 gboolean text_nroff_mode
; /* Nroff-style highlighting */
75 gboolean text_wrap_mode
; /* Wrap text lines to fit them on the screen */
76 gboolean magic_mode
; /* Preprocess the file using external programs */
78 /* Additional editor state */
79 gboolean hexedit_lownibble
; /* Are we editing the last significant nibble? */
80 GArray
*coord_cache
; /* Cache for mapping offsets to cursor positions */
82 /* Display information */
83 screen_dimen dpy_frame_size
;/* Size of the frame surrounding the real viewer */
84 offset_type dpy_start
; /* Offset of the displayed data */
85 offset_type dpy_end
; /* Offset after the displayed data */
86 offset_type dpy_text_column
;/* Number of skipped columns in non-wrap
88 offset_type hex_cursor
; /* Hexview cursor position in file */
89 screen_dimen cursor_col
; /* Cursor column */
90 screen_dimen cursor_row
; /* Cursor row */
91 struct hexedit_change_node
*change_list
; /* Linked list of changes */
92 struct area status_area
; /* Where the status line is displayed */
93 struct area ruler_area
; /* Where the ruler is displayed */
94 struct area data_area
; /* Where the data is displayed */
96 int dirty
; /* Number of skipped updates */
97 gboolean dpy_bbar_dirty
; /* Does the button bar need to be updated? */
100 int bytes_per_line
; /* Number of bytes per line in hex mode */
102 /* Search variables */
103 offset_type search_start
; /* First character to start searching from */
104 offset_type search_end
; /* Length of found string or 0 if none was found */
106 /* Pointer to the last search command */
107 gboolean want_to_quit
; /* Prepare for cleanup ... */
110 int marker
; /* mark to use */
111 offset_type marks
[10]; /* 10 marks: 0..9 */
113 int move_dir
; /* return value from widget:
115 * -1 view previous file
119 offset_type update_steps
; /* The number of bytes between percent
121 offset_type update_activate
;/* Last point where we updated the status */
123 /* converter for translation of text */
126 /* handle of search engine */
128 gchar
*last_search_string
;
129 mc_search_type_t search_type
;
130 gboolean search_all_codepages
;
131 gboolean search_case
;
132 gboolean search_backwards
;
134 int search_numNeedSkipChar
;
137 /*** global variables defined in .c file *******************************/
139 /*** declarations of public functions **********************************/