2003-06-30 16:44:03 +04:00
|
|
|
/*
|
2006-02-13 02:07:28 +03:00
|
|
|
* Copyright 2006 James Bursa <bursa@users.sourceforge.net>
|
2006-02-16 02:09:55 +03:00
|
|
|
* Copyright 2006 Adrian Lees <adrianl@users.sourceforge.net>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-02-13 02:07:28 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Content for text/plain (interface).
|
2003-02-09 15:58:15 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETSURF_RENDER_TEXTPLAIN_H_
|
|
|
|
#define _NETSURF_RENDER_TEXTPLAIN_H_
|
|
|
|
|
2006-02-16 02:09:55 +03:00
|
|
|
#include <stddef.h>
|
2010-06-04 13:35:08 +04:00
|
|
|
#include "desktop/mouse.h"
|
2006-02-13 03:17:44 +03:00
|
|
|
|
2004-03-11 05:19:14 +03:00
|
|
|
struct content;
|
2010-03-28 16:56:39 +04:00
|
|
|
struct hlcache_handle;
|
|
|
|
struct http_parameter;
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2006-02-16 02:09:55 +03:00
|
|
|
struct textplain_line {
|
|
|
|
size_t start;
|
|
|
|
size_t length;
|
|
|
|
};
|
|
|
|
|
2006-02-13 02:07:28 +03:00
|
|
|
struct content_textplain_data {
|
2010-04-04 16:41:19 +04:00
|
|
|
char *encoding;
|
2010-09-14 02:18:51 +04:00
|
|
|
void *inputstream;
|
2006-02-13 02:07:28 +03:00
|
|
|
char *utf8_data;
|
|
|
|
size_t utf8_data_size;
|
|
|
|
size_t utf8_data_allocated;
|
|
|
|
unsigned long physical_line_count;
|
2006-02-16 02:09:55 +03:00
|
|
|
struct textplain_line *physical_line;
|
|
|
|
int formatted_width;
|
2006-02-13 02:07:28 +03:00
|
|
|
};
|
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
bool textplain_create(struct content *c, const struct http_parameter *params);
|
2010-04-03 20:37:36 +04:00
|
|
|
bool textplain_process_data(struct content *c,
|
|
|
|
const char *data, unsigned int size);
|
2010-03-30 02:33:21 +04:00
|
|
|
bool textplain_convert(struct content *c);
|
2010-06-04 13:35:08 +04:00
|
|
|
void textplain_mouse_track(struct content *c, struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
|
|
|
void textplain_mouse_action(struct content *c, struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
2006-02-13 02:07:28 +03:00
|
|
|
void textplain_reformat(struct content *c, int width, int height);
|
|
|
|
void textplain_destroy(struct content *c);
|
|
|
|
bool textplain_redraw(struct content *c, int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
2008-09-29 02:37:13 +04:00
|
|
|
float scale, colour background_colour);
|
2010-04-04 16:41:19 +04:00
|
|
|
bool textplain_clone(const struct content *old, struct content *new_content);
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2006-02-16 02:09:55 +03:00
|
|
|
/* access to lines for text selection and searching */
|
2010-03-28 16:56:39 +04:00
|
|
|
unsigned long textplain_line_count(struct hlcache_handle *h);
|
|
|
|
size_t textplain_size(struct hlcache_handle *h);
|
2006-02-16 02:09:55 +03:00
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
size_t textplain_offset_from_coords(struct hlcache_handle *h, int x, int y,
|
|
|
|
int dir);
|
|
|
|
void textplain_coords_from_range(struct hlcache_handle *h,
|
2006-02-16 02:09:55 +03:00
|
|
|
unsigned start, unsigned end, struct rect *r);
|
2010-03-28 16:56:39 +04:00
|
|
|
char *textplain_get_line(struct hlcache_handle *h, unsigned lineno,
|
2006-02-16 02:09:55 +03:00
|
|
|
size_t *poffset, size_t *plen);
|
2010-03-28 16:56:39 +04:00
|
|
|
int textplain_find_line(struct hlcache_handle *h, unsigned offset);
|
|
|
|
char *textplain_get_raw_data(struct hlcache_handle *h,
|
2006-02-16 02:09:55 +03:00
|
|
|
unsigned start, unsigned end, size_t *plen);
|
|
|
|
|
2003-02-09 15:58:15 +03:00
|
|
|
#endif
|