diff options
Diffstat (limited to 'window.h')
| -rw-r--r-- | window.h | 84 |
1 files changed, 42 insertions, 42 deletions
@@ -7,7 +7,7 @@ #include "ui.h" #include "syntax.h" -typedef struct Win Win; +typedef struct View View; typedef struct { void *data; @@ -40,76 +40,76 @@ typedef struct { size_t col; } CursorPos; -Win *window_new(Text*, ViewEvent*); -void window_ui(Win*, UiWin*); +View *view_new(Text*, ViewEvent*); +void view_ui(View*, UiWin*); /* change associated text displayed in this window */ -void window_reload(Win*, Text*); -void window_free(Win*); +void view_reload(View*, Text*); +void view_free(View*); /* keyboard input at cursor position */ -size_t window_insert_key(Win*, const char *c, size_t len); -size_t window_replace_key(Win*, const char *c, size_t len); -size_t window_backspace_key(Win*); -size_t window_delete_key(Win*); +size_t view_insert_key(View*, const char *c, size_t len); +size_t view_replace_key(View*, const char *c, size_t len); +size_t view_backspace_key(View*); +size_t view_delete_key(View*); -bool window_resize(Win*, int width, int height); -int window_height_get(Win*); -void window_draw(Win*); +bool view_resize(View*, int width, int height); +int view_height_get(View*); +void view_draw(View*); /* changes how many spaces are used for one tab (must be >0), redraws the window */ -void window_tabwidth_set(Win*, int tabwidth); +void view_tabwidth_set(View*, int tabwidth); /* cursor movements which also update selection if one is active. * they return new cursor postion */ -size_t window_char_next(Win*); -size_t window_char_prev(Win*); -size_t window_line_down(Win*); -size_t window_line_up(Win*); -size_t window_screenline_down(Win*); -size_t window_screenline_up(Win*); -size_t window_screenline_begin(Win*); -size_t window_screenline_middle(Win*); -size_t window_screenline_end(Win*); +size_t view_char_next(View*); +size_t view_char_prev(View*); +size_t view_line_down(View*); +size_t view_line_up(View*); +size_t view_screenline_down(View*); +size_t view_screenline_up(View*); +size_t view_screenline_begin(View*); +size_t view_screenline_middle(View*); +size_t view_screenline_end(View*); /* move window content up/down, but keep cursor position unchanged unless it is * on a now invisible line in which case we try to preserve the column position */ -size_t window_slide_up(Win*, int lines); -size_t window_slide_down(Win*, int lines); +size_t view_slide_up(View*, int lines); +size_t view_slide_down(View*, int lines); /* scroll window contents up/down by lines, place the cursor on the newly * visible line, try to preserve the column position */ -size_t window_scroll_up(Win*, int lines); -size_t window_scroll_down(Win*, int lines); +size_t view_scroll_up(View*, int lines); +size_t view_scroll_down(View*, int lines); /* place the cursor at the start ot the n-th window line, counting from 1 */ -size_t window_screenline_goto(Win*, int n); +size_t view_screenline_goto(View*, int n); /* get cursor position in bytes from start of the file */ -size_t window_cursor_get(Win*); +size_t view_cursor_get(View*); -const Line *window_lines_get(Win*); +const Line *view_lines_get(View*); /* get cursor position in terms of screen coordinates */ -CursorPos window_cursor_getpos(Win*); +CursorPos view_cursor_getpos(View*); /* moves window viewport in direction until pos is visible. should only be * used for short distances between current cursor position and destination */ -void window_scroll_to(Win*, size_t pos); +void view_scroll_to(View*, size_t pos); /* move cursor to a given position. changes the viewport to make sure that * position is visible. if the position is in the middle of a line, try to * adjust the viewport in such a way that the whole line is displayed */ -void window_cursor_to(Win*, size_t pos); +void view_cursor_to(View*, size_t pos); /* redraw current cursor line at top/center/bottom of window */ -void window_redraw_top(Win*); -void window_redraw_center(Win*); -void window_redraw_bottom(Win*); +void view_redraw_top(View*); +void view_redraw_center(View*); +void view_redraw_bottom(View*); /* start selected area at current cursor position. further cursor movements will * affect the selected region. */ -void window_selection_start(Win*); +void view_selection_start(View*); /* returns the currently selected text region, is either empty or well defined, * i.e. sel.start <= sel.end */ -Filerange window_selection_get(Win*); -void window_selection_set(Win*, Filerange *sel); +Filerange view_selection_get(View*); +void view_selection_set(View*, Filerange *sel); /* clear selection and redraw window */ -void window_selection_clear(Win*); +void view_selection_clear(View*); /* get the currently displayed area in bytes from the start of the file */ -Filerange window_viewport_get(Win*); +Filerange view_viewport_get(View*); /* associate a set of syntax highlighting rules to this window. */ -void window_syntax_set(Win*, Syntax*); -Syntax *window_syntax_get(Win*); +void view_syntax_set(View*, Syntax*); +Syntax *view_syntax_get(View*); #endif |
