Merge branch '4650_shift_f4_segfault'
[midnight-commander.git] / src / diffviewer / internal.h
blobbd3213c54bdb70f2b587184c71f7ba84dc2b7cb0
1 #ifndef MC__DIFFVIEW_INTERNAL_H
2 #define MC__DIFFVIEW_INTERNAL_H
4 #include "lib/global.h"
5 #include "lib/mcconfig.h"
6 #include "lib/search.h"
7 #include "lib/tty/color.h"
8 #include "lib/widget.h"
10 /*** typedefs(not structures) and defined constants **********************************************/
12 typedef int (*DFUNC) (void *ctx, int ch, int line, off_t off, size_t sz, const char *str);
13 typedef int PAIR[2];
15 #define error_dialog(h, s) query_dialog (h, s, D_ERROR, 1, _ ("&Dismiss"))
17 /*** enums ***************************************************************************************/
19 typedef enum
21 DATA_SRC_MEM = 0,
22 DATA_SRC_TMP = 1,
23 DATA_SRC_ORG = 2
24 } DSRC;
26 typedef enum
28 DIFF_LEFT = 0,
29 DIFF_RIGHT = 1,
30 DIFF_COUNT = 2
31 } diff_place_t;
33 typedef enum
35 DIFF_NONE = 0,
36 DIFF_ADD = 1,
37 DIFF_DEL = 2,
38 DIFF_CHG = 3
39 } DiffState;
41 /*** structures declarations (and typedefs of structures)*****************************************/
43 typedef struct
45 int fd;
46 int pos;
47 int len;
48 char *buf;
49 int flags;
50 void *data;
51 } FBUF;
53 typedef struct
55 int a[2][2];
56 int cmd;
57 } DIFFCMD;
59 typedef struct
61 int off;
62 int len;
63 } BRACKET[DIFF_COUNT];
65 typedef struct
67 int ch;
68 int line;
69 union
71 off_t off;
72 size_t len;
73 } u;
74 void *p;
75 } DIFFLN;
77 typedef struct
79 FBUF *f;
80 GArray *a;
81 DSRC dsrc;
82 } PRINTER_CTX;
84 typedef struct WDiff
86 Widget widget;
88 const char *args; // Args passed to diff
89 const char *file[DIFF_COUNT]; // filenames
90 char *label[DIFF_COUNT];
91 FBUF *f[DIFF_COUNT];
92 const char *backup_sufix;
93 gboolean merged[DIFF_COUNT];
94 GArray *a[DIFF_COUNT];
95 GPtrArray *hdiff;
96 int ndiff; // number of hunks
97 DSRC dsrc; // data source: memory or temporary file
99 gboolean view_quit; // Quit flag
101 int height;
102 int half1;
103 int half2;
104 int width1;
105 int width2;
106 int bias;
107 gboolean new_frame;
108 int skip_rows;
109 int skip_cols;
110 gboolean display_symbols;
111 int display_numbers;
112 gboolean show_cr;
113 int tab_size;
114 diff_place_t ord;
115 gboolean full;
117 #ifdef HAVE_CHARSET
118 gboolean utf8;
119 // converter for translation of text
120 GIConv converter;
121 #endif
123 struct
125 int quality;
126 gboolean strip_trailing_cr;
127 gboolean ignore_tab_expansion;
128 gboolean ignore_space_change;
129 gboolean ignore_all_space;
130 gboolean ignore_case;
131 } opt;
133 // Search variables
134 struct
136 mc_search_t *handle;
137 gchar *last_string;
139 ssize_t last_found_line;
140 ssize_t last_accessed_num_line;
141 } search;
142 } WDiff;
144 /*** global variables defined in .c file *********************************************************/
146 /*** declarations of public functions ************************************************************/
148 /* search.c */
149 void dview_search_cmd (WDiff *dview);
150 void dview_continue_search_cmd (WDiff *dview);
152 #endif