summaryrefslogtreecommitdiffstats
path: root/src/editor/edit.h
blob: 358aa3f147ae500aa49ac4ec8992f4aaaf8cf53b (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
   Editor public API
 */

/** \file edit.h
 *  \brief Header: editor public API
 *  \author Paul Sheer
 *  \date 1996, 1997
 *  \author Andrew Borodin
 *  \date 2009, 2012
 */

#ifndef MC__EDIT_H
#define MC__EDIT_H

#include "lib/global.h"         /* PATH_SEP_STR */
#include "lib/vfs/vfs.h"        /* vfs_path_t */

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

#define DEFAULT_WRAP_LINE_LENGTH 72

#define EDIT(x) ((WEdit *)(x))
#define CONST_EDIT(x) ((const WEdit *)(x))

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

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

/* Editor widget */
struct WEdit;
typedef struct WEdit WEdit;

typedef struct
{
    int word_wrap_line_length;
    gboolean typewriter_wrap;
    gboolean auto_para_formatting;
    gboolean fill_tabs_with_spaces;
    gboolean return_does_auto_indent;
    gboolean backspace_through_tabs;
    gboolean fake_half_tabs;
    gboolean persistent_selections;
    gboolean drop_selection_on_copy;    /* whether we need to drop selection on copy to buffer */
    gboolean cursor_beyond_eol;
    gboolean cursor_after_inserted_block;
    gboolean state_full_filename;
    gboolean line_state;
    int line_state_width;
    int save_mode;
    gboolean confirm_save;      /* queries on a save */
    gboolean save_position;
    gboolean syntax_highlighting;
    gboolean group_undo;
    char *backup_ext;
    char *filesize_threshold;
    char *stop_format_chars;
    gboolean visible_tabs;
    gboolean visible_tws;
    gboolean show_right_margin;
    gboolean simple_statusbar;  /* statusbar draw style */
    gboolean check_nl_at_eof;
} edit_options_t;

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

extern edit_options_t edit_options;

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

/* used in main() */
void edit_stack_init (void);
void edit_stack_free (void);

gboolean edit_file (const vfs_path_t * file_vpath, long line);
gboolean edit_files (const GList * files);

const char *edit_get_file_name (const WEdit * edit);
off_t edit_get_cursor_offset (const WEdit * edit);
long edit_get_curs_col (const WEdit * edit);
const char *edit_get_syntax_type (const WEdit * edit);

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