5 /* The growing buffers data types */
8 int present
; /* Unused, for DOS port maybe */
19 char *filename
; /* Name of the file */
20 char *command
; /* Command used to pipe data in */
25 unsigned char *data
; /* Memory area for the file to be viewed */
27 /* File information */
28 int file
; /* File descriptor (for mmap and munmap) */
29 FILE *stdfile
; /* Stdio struct for reading file in parts */
30 int reading_pipe
; /* Flag: Reading from pipe(use popen/pclose) */
31 unsigned long bytes_read
; /* How much of file is read */
32 int mmapping
; /* Did we use mmap on the file? */
34 /* Display information */
35 unsigned long last
; /* Last byte shown */
36 unsigned long last_byte
; /* Last byte of file */
37 long first
; /* First byte in file */
38 long bottom_first
; /* First byte shown when very last page is displayed */
39 /* For the case of WINCH we should reset it to -1 */
40 unsigned long start_display
;/* First char displayed */
41 int start_col
; /* First displayed column, negative */
42 unsigned long edit_cursor
; /* HexEdit cursor position in file */
43 char hexedit_mode
; /* Hexidecimal editing mode flag */
44 char nib_shift
; /* A flag for inserting nibbles into bytes */
45 enum ViewSide view_side
; /* A flag for the active editing panel */
46 int file_dirty
; /* Number of changes */
47 int start_save
; /* Line start shift between Ascii and Hex */
48 int cursor_col
; /* Cursor column */
49 int cursor_row
; /* Cursor row */
50 struct hexedit_change_node
*change_list
; /* Linked list of changes */
52 int dirty
; /* Number of skipped updates */
53 int wrap_mode
; /* wrap_mode */
56 int hex_mode
; /* Hexadecimal mode flag */
57 int bytes_per_line
; /* Number of bytes per line in hex mode */
58 int viewer_magic_flag
; /* Selected viewer */
59 int viewer_nroff_flag
; /* Do we do nroff style highlighting? */
61 /* Growing buffers information */
62 int growing_buffer
; /* Use the growing buffers? */
63 block_ptr_t
*block_ptr
; /* Pointer to the block pointers */
64 int blocks
; /* The number of blocks in *block_ptr */
67 /* Search variables */
68 int search_start
; /* First character to start searching from */
69 int found_len
; /* Length of found string or 0 if none was found */
70 char *search_exp
; /* The search expression */
71 int direction
; /* 1= forward; -1 backward */
72 void (*last_search
)(void *, char *);
73 /* Pointer to the last search command */
74 int view_quit
; /* Quit flag */
76 int monitor
; /* Monitor file growth (like tail -f) */
78 int marker
; /* mark to use */
79 int marks
[10]; /* 10 marks: 0..9 */
82 int move_dir
; /* return value from widget:
84 * -1 view previous file
87 struct stat s
; /* stat for file */
90 #define vwidth (view->widget.cols - (view->have_frame ? 2 : 0))
91 #define vheight (view->widget.lines - (view->have_frame ? 2 : 0))
93 /* Creation/initialization of a new view widget */
94 WView
*view_new (int y
, int x
, int cols
, int lines
, int is_panel
);
95 int view_init (WView
*view
, char *_command
, const char *_file
, int start_line
);
96 void view_update_bytes_per_line(WView
*view
);
97 int view_file (char *filename
, int normal
, int internal
);
99 /* Internal view routines */
100 void view_status (WView
*, gboolean update_gui
);
101 void view_percent (WView
*, int p
, int w
, gboolean update_gui
);
102 void view_update (WView
*view
, gboolean update_gui
);
103 void view_labels (WView
*view
);
104 int view_event (WView
*view
, Gpm_Event
*event
,int *result
);
105 void toggle_wrap_mode (WView
*);
106 void toggle_hex_mode (WView
*);
107 void goto_line (WView
*);
108 void regexp_search_cmd (WView
*);
109 void normal_search_cmd (WView
*);
110 void continue_search (WView
*);
111 void change_nroff (WView
*view
);
112 void set_monitor (WView
*view
, int set_on
);
113 void view_move_forward (WView
*view
, int i
);
114 void view_move_backward (WView
*view
, int i
);
115 void view_add_one_vline (void);
116 void view_add_character (WView
*view
, int c
);
117 void view_add_string (WView
*view
, char *s
);
118 void view_gotoyx (WView
*view
, int r
, int c
);
119 void view_set_color (WView
*view
, int font
);
120 int view_ok_to_quit (WView
*view
);
121 #endif /* WANT_WIDGETS */
123 /* Command: view a file, if _command != NULL we use popen on _command */
124 /* move direction should be apointer that will hold the direction in which the user */
125 /* wants to move (-1 previous file, 1 next file, 0 do nothing) */
126 int view (char *_command
, const char *_file
, int *move_direction
, int start_line
);
128 extern int mouse_move_pages_viewer
;
129 extern int max_dirt_limit
;
130 extern int global_wrap_mode
;
131 extern int have_fast_cpu
;
132 extern int default_hex_mode
;
133 extern int default_magic_flag
;
134 extern int default_nroff_flag
;
135 extern int altered_hex_mode
;
136 extern int altered_magic_flag
;
137 extern int altered_nroff_flag
;
138 extern Dlg_head
*view_dlg
;
140 void view_adjust_size (Dlg_head
*);
142 /* A node for building a change list on change_list */
143 struct hexedit_change_node
{
144 struct hexedit_change_node
*next
;
149 #endif /* __VIEW_H */