From c921eed7f3a10b6e403d5d5863df82c652ca5db9 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 25 Jan 2017 00:01:45 +0100 Subject: Implement text selection --- src/frame.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/frame.h') diff --git a/src/frame.h b/src/frame.h index 4f8be33..787a2ec 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1,7 +1,7 @@ /* * frame.h * - * Copyright © 2013-2016 Thomas White + * Copyright © 2013-2017 Thomas White * * This file is part of Colloquium. * @@ -58,6 +58,15 @@ enum para_type typedef struct _paragraph Paragraph; + +struct edit_pos +{ + int para; + size_t pos; + int trail; +}; + + struct frame { struct frame **children; @@ -135,13 +144,19 @@ extern void add_image_para(struct frame *fr, SCBlock *scblock, const char *filename, double w, double h, int editable); -extern void wrap_paragraph(Paragraph *para, PangoContext *pc, double w); +extern void wrap_paragraph(Paragraph *para, PangoContext *pc, double w, + size_t sel_start, size_t sel_end); extern size_t end_offset_of_para(struct frame *fr, int pn); extern int find_cursor(struct frame *fr, double x, double y, int *ppara, size_t *ppos, int *ptrail); +extern int find_cursor_2(struct frame *fr, double x, double y, + struct edit_pos *pos); + +extern void sort_positions(struct edit_pos *a, struct edit_pos *b); + extern int get_para_highlight(struct frame *fr, int cursor_para, double *cx, double *cy, double *cw, double *ch); -- cgit v1.2.3