Manual pages: mcmcdiffmceditmcview

root/src/editor/editwidget.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


   1 /** \file
   2  *  \brief Header: editor widget WEdit
   3  */
   4 
   5 #ifndef MC__EDIT_WIDGET_H
   6 #define MC__EDIT_WIDGET_H
   7 
   8 #include <limits.h>  // MB_LEN_MAX
   9 
  10 #include "lib/search.h"  // mc_search_t
  11 #include "lib/widget.h"  // Widget
  12 
  13 #include "edit-impl.h"
  14 #include "editbuffer.h"
  15 
  16 /*** typedefs(not structures) and defined constants **********************************************/
  17 
  18 #define N_LINE_CACHES 32
  19 
  20 /*** enums ***************************************************************************************/
  21 
  22 /*** structures declarations (and typedefs of structures)*****************************************/
  23 
  24 typedef struct edit_book_mark_t edit_book_mark_t;
  25 struct edit_book_mark_t
  26 {
  27     long line;  // line number
  28     int c;      // color
  29     edit_book_mark_t *next;
  30     edit_book_mark_t *prev;
  31 };
  32 
  33 typedef struct edit_syntax_rule_t edit_syntax_rule_t;
  34 struct edit_syntax_rule_t
  35 {
  36     unsigned short keyword;
  37     off_t end;
  38     unsigned char context;
  39     unsigned char _context;
  40     unsigned char border;
  41 };
  42 
  43 /*
  44  * State of WEdit window
  45  * MCEDIT_DRAG_NONE   - window is in normal mode
  46  * MCEDIT_DRAG_MOVE   - window is being moved
  47  * MCEDIT_DRAG_RESIZE - window is being resized
  48  */
  49 typedef enum
  50 {
  51     MCEDIT_DRAG_NONE = 0,
  52     MCEDIT_DRAG_MOVE,
  53     MCEDIT_DRAG_RESIZE
  54 } mcedit_drag_state_t;
  55 
  56 struct WEdit
  57 {
  58     Widget widget;
  59     mcedit_drag_state_t drag_state;
  60     int drag_state_start;  // save cursor position before window moving
  61 
  62     // save location before move/resize or toggle to fullscreen
  63     WRect loc_prev;
  64 
  65     vfs_path_t *filename_vpath;  // Name of the file
  66     vfs_path_t *dir_vpath;       // NULL if filename is absolute
  67 
  68     // dynamic buffers and cursor position for editor:
  69     edit_buffer_t buffer;
  70 
  71     // multibyte support
  72     gboolean utf8;  // It's multibyte file codeset
  73     GIConv converter;
  74     char charbuf[MB_LEN_MAX + 1];
  75     int charpoint;
  76 
  77     // search handler
  78     mc_search_t *search;
  79     int replace_mode;
  80     // whether search conditions should be started with BOL(^) or ended with EOL($)
  81     mc_search_line_t search_line_type;
  82 
  83     char *last_search_string;  // String that have been searched
  84     off_t search_start;        // First character to start searching from
  85     unsigned long found_len;   // Length of found string or 0 if none was found
  86     off_t found_start;         // the found word from a search - start position
  87 
  88     // display information
  89     long start_display;             // First char displayed
  90     long start_col;                 // First displayed column, negative
  91     long curs_row;                  // row position of cursor on the screen
  92     long curs_col;                  // column position on screen
  93     long over_col;                  // pos after '\n'
  94     int force;                      // how much of the screen do we redraw?
  95     unsigned int overwrite : 1;     // Overwrite on type mode (as opposed to insert)
  96     unsigned int modified : 1;      // File has been modified and needs saving
  97     unsigned int loading_done : 1;  // File has been loaded into the editor
  98     unsigned int locked : 1;        // We hold lock on current file
  99     unsigned int delete_file : 1;   // New file, needs to be deleted unless modified
 100     unsigned int highlight : 1;     // There is a selected block
 101     unsigned int column_highlight : 1;
 102     unsigned int fullscreen : 1;  // Is window fullscreen or not
 103     long prev_col;                /* recent column position of the cursor - used when moving
 104                                      up or down past lines that are shorter than the current line */
 105     long start_line;              // line number of the top of the page
 106 
 107     // file info
 108     off_t mark1;          // position of highlight start
 109     off_t mark2;          // position of highlight end
 110     off_t end_mark_curs;  // position of cursor after end of highlighting
 111     long column1;         // position of column highlight start
 112     long column2;         // position of column highlight end
 113     off_t bracket;        // position of a matching bracket
 114     off_t last_bracket;   // previous position of a matching bracket
 115 
 116     // cache speedup for line lookups
 117     gboolean caches_valid;
 118     long line_numbers[N_LINE_CACHES];
 119     off_t line_offsets[N_LINE_CACHES];
 120 
 121     edit_book_mark_t *book_mark;
 122     GArray *serialized_bookmarks;
 123 
 124     // undo stack and pointers
 125     unsigned long undo_stack_pointer;
 126     long *undo_stack;
 127     unsigned long undo_stack_size;
 128     unsigned long undo_stack_size_mask;
 129     unsigned long undo_stack_bottom;
 130     unsigned int undo_stack_disable : 1;  // If not 0, don't save events in the undo stack
 131 
 132     unsigned long redo_stack_pointer;
 133     long *redo_stack;
 134     unsigned long redo_stack_size;
 135     unsigned long redo_stack_size_mask;
 136     unsigned long redo_stack_bottom;
 137     unsigned int redo_stack_reset : 1;  // If 1, need clear redo stack
 138 
 139     struct stat stat1;    // Result of mc_fstat() on the file
 140     unsigned long attrs;  // Result of mc_fgetflags() on the file
 141     gboolean attrs_ok;    // mc_fgetflags() == 0
 142 
 143     unsigned int skip_detach_prompt : 1;  // Do not prompt whether to detach a file anymore
 144 
 145     // syntax highlighting
 146     GSList *syntax_marker;
 147     GPtrArray *rules;
 148     off_t last_get_rule;
 149     edit_syntax_rule_t rule;
 150     char *syntax_type;             // description of syntax highlighting type being used
 151     GTree *defines;                // List of defines
 152     gboolean is_case_insensitive;  // selects language case sensitivity
 153 
 154     // line break
 155     LineBreaks lb;
 156 };
 157 
 158 /*** global variables defined in .c file *********************************************************/
 159 
 160 /*** declarations of public functions ************************************************************/
 161 
 162 /*** inline functions ****************************************************************************/
 163 #endif

/* [previous][next][first][last][top][bottom][index][help]  */