From 6e4c82265c08a3d1631b5194a3cbbb4e1d615f2d Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 9 Jan 2013 23:42:14 +0000 Subject: Get CSET using PropChunk rather than StopChunk --- amiga/clipboard.c | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/amiga/clipboard.c b/amiga/clipboard.c index 5e51efc70..3be545c03 100644 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -122,7 +122,7 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size { struct CollectionItem *ci_new = NULL, *ci_next, *ci_curr = ci; size_t len = 0; - char *text = NULL, *p, *clip; + char *text = NULL, *p; /* Scan the collected chunks to find out the total size. * If they are not in UTF-8, convert the chunks first and create a new CollectionItem list. @@ -142,7 +142,7 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size ci_next = ci_new; } - utf8_from_local_encoding(ci_curr->ci_Data, ci_curr->ci_Size, &ci_next->ci_Data); + utf8_from_local_encoding(ci_curr->ci_Data, ci_curr->ci_Size, (char **)&ci_next->ci_Data); ci_next->ci_Size = strlen(ci_next->ci_Data); len += ci_next->ci_Size; break; @@ -159,7 +159,7 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size utf8_from_enc(ci_curr->ci_Data, (const char *)ObtainCharsetInfo(DFCS_NUMBER, codeset, DFCS_MIMENAME), - ci_curr->ci_Size, &clip); + ci_curr->ci_Size, (char **)&ci_next->ci_Data); ci_next->ci_Size = strlen(ci_next->ci_Data); len += ci_next->ci_Size; break; @@ -199,43 +199,26 @@ void gui_get_clipboard(char **buffer, size_t *length) { struct ContextNode *cn; struct CollectionItem *ci = NULL; + struct StoredProperty *sp = NULL; ULONG rlen=0,error; - struct CSet cset; + struct CSet *cset; LONG codeset = 0; - cset.CodeSet = 0; - if(OpenIFF(iffh,IFFF_READ)) return; if(CollectionChunk(iffh,ID_FTXT,ID_CHRS)) return; - if(StopChunk(iffh,ID_FTXT,ID_CSET)) return; + if(PropChunk(iffh,ID_FTXT,ID_CSET)) return; if(CollectionChunk(iffh,ID_FTXT,ID_UTF8)) return; - while(1) - { - error = ParseIFF(iffh,IFFPARSE_SCAN); - if(error == IFFERR_EOC) continue; - else if(error) break; - - cn = CurrentChunk(iffh); - - if((cn)&&(cn->cn_Type == ID_FTXT)&&(cn->cn_ID == ID_CSET)) - { - /* Ideally when we stop here, we need to convert all CHRS chunks up to this - * point based on the previous codeset. However, for simplicity, we just - * assume only one CSET chunk is present and only take note of the last - * CSET chunk if there is more than one. - */ - - rlen = ReadChunkBytes(iffh, &cset, 32); - if(cset.CodeSet == 1) codeset = 106; - else codeset = cset.CodeSet; - } - } + error = ParseIFF(iffh,IFFPARSE_SCAN); if(ci = FindCollection(iffh, ID_FTXT, ID_UTF8)) { *buffer = ami_clipboard_cat_collection(ci, 106, length); } else if(ci = FindCollection(iffh, ID_FTXT, ID_CHRS)) { + if(sp = FindProp(iffh, ID_FTXT, ID_CSET)) { + cset = (struct CSet *)sp->sp_Data; + codeset = cset->CodeSet; + } *buffer = ami_clipboard_cat_collection(ci, codeset, length); } -- cgit v1.2.3 From 32693336583eb14b488a01c6ea5f5e002ab3deb0 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 10 Jan 2013 00:00:51 +0000 Subject: Fix reading of clipboard --- amiga/clipboard.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/amiga/clipboard.c b/amiga/clipboard.c index 3be545c03..3897851b8 100644 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -175,9 +175,9 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size p = text + len; if(ci_new) { - ci_curr = ci; - } else { ci_curr = ci_new; + } else { + ci_curr = ci; } do { @@ -209,6 +209,7 @@ void gui_get_clipboard(char **buffer, size_t *length) if(CollectionChunk(iffh,ID_FTXT,ID_CHRS)) return; if(PropChunk(iffh,ID_FTXT,ID_CSET)) return; if(CollectionChunk(iffh,ID_FTXT,ID_UTF8)) return; + if(StopOnExit(iffh, ID_FTXT, ID_FORM)) return; error = ParseIFF(iffh,IFFPARSE_SCAN); -- cgit v1.2.3 From 4cad82db9f907fb8ffd42303527a976ca226cedd Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 10 Jan 2013 12:46:33 +0000 Subject: Fix caret placement in multi-line textareas. --- desktop/textarea.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 31effdc3c..0f42a9f30 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -1058,12 +1058,12 @@ void textarea_redraw(struct textarea *ta, int x, int y, /* There is no selection and caret is in horizontal * clip range. */ int caret_height = ta->line_height - 1; - y += ta->caret_y + text_y_offset; - if (y + caret_height >= clip->y0 && y <= clip->y1) + r.y0 = y + ta->caret_y + text_y_offset; + if (r.y0 + caret_height >= clip->y0 && r.y0 <= clip->y1) /* Caret in vertical clip range; plot */ - plot->line(x + ta->caret_x, y + ta->caret_y, + plot->line(x + ta->caret_x, r.y0, x + ta->caret_x, - y + ta->caret_y + caret_height, + r.y0 + caret_height, &pstyle_stroke_caret); } } @@ -1082,7 +1082,6 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) line = ta->caret_pos.line; readonly = (ta->flags & TEXTAREA_READONLY ? true:false); - if (!(key <= 0x001F || (0x007F <= key && key <= 0x009F))) { /* normal character insertion */ length = utf8_from_ucs4(key, utf8); -- cgit v1.2.3 From eddb0f17d183cec2013d23e613e70cc03345e57f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 10 Jan 2013 15:06:05 +0000 Subject: Simplfy caret placement and redraw. --- desktop/textarea.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 0f42a9f30..79b1ed436 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -831,9 +831,9 @@ bool textarea_set_caret(struct textarea *ta, int caret) b_off - ta->lines[ta->caret_pos.line].b_start, &x); - x += MARGIN_LEFT - ta->scroll_x; + x += MARGIN_LEFT; ta->caret_x = x; - y = ta->line_height * ta->caret_pos.line - ta->scroll_y; + y = ta->line_height * ta->caret_pos.line; ta->caret_y = y; if (textarea_scroll_visible(ta)) { @@ -1051,20 +1051,17 @@ void textarea_redraw(struct textarea *ta, int x, int y, &ta->fstyle); } - if ((ta->sel_end == -1 || - ta->sel_start == ta->sel_end) && - x + ta->caret_x >= clip->x0 && - x + ta->caret_x <= clip->x1) { - /* There is no selection and caret is in horizontal - * clip range. */ - int caret_height = ta->line_height - 1; - r.y0 = y + ta->caret_y + text_y_offset; - if (r.y0 + caret_height >= clip->y0 && r.y0 <= clip->y1) - /* Caret in vertical clip range; plot */ - plot->line(x + ta->caret_x, r.y0, - x + ta->caret_x, - r.y0 + caret_height, - &pstyle_stroke_caret); + x -= ta->scroll_x; + y -= ta->scroll_y; + + if (ta->sel_end == -1 || ta->sel_start == ta->sel_end) { + /* There is no selection; draw caret */ + int caret_y = y + ta->caret_y + text_y_offset; + int caret_height = caret_y + ta->line_height - 1; + + plot->line(x + ta->caret_x, caret_y, + x + ta->caret_x, caret_height, + &pstyle_stroke_caret); } } -- cgit v1.2.3 From 2158ef60a871a434450021fd5588820ff93fbefa Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 10 Jan 2013 17:42:43 +0000 Subject: Improve reflow in multiline textareas. --- desktop/textarea.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 79b1ed436..e5f140dfa 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -335,6 +335,12 @@ static bool textarea_reflow(struct textarea *ta, unsigned int line) ta->vis_width - MARGIN_LEFT - MARGIN_RIGHT, &b_off, &x); + if (b_off == 0) { + /* Text wasn't split */ + b_off = len; + } + /* b_off now marks space, or end of text */ + if (line_count > 0 && line_count % LINE_CHUNK_SIZE == 0) { struct line_info *temp = realloc(ta->lines, (line_count + LINE_CHUNK_SIZE) * @@ -352,8 +358,9 @@ static bool textarea_reflow(struct textarea *ta, unsigned int line) if (*space == '\n') break; } + /* space now marks newline, or b_off -- whichever's first */ - if (space <= text + b_off) { + if (space < text + b_off) { /* Found newline; use it */ ta->lines[line_count].b_start = text - ta->text; ta->lines[line_count++].b_length = space - text; @@ -368,10 +375,9 @@ static bool textarea_reflow(struct textarea *ta, unsigned int line) } continue; - } - if (len - b_off > 0) { - /* find last space (if any) */ + } else if (len - b_off > 0) { + /* soft wraped, find last space (if any) */ for (space = text + b_off; space > text; space--) if (*space == ' ') break; -- cgit v1.2.3 From d3973b29917e049198badebf65f9e6290734b883 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 10 Jan 2013 18:36:25 +0000 Subject: Fix previous caret position redraw. --- desktop/textarea.c | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index e5f140dfa..828503f69 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -568,7 +568,7 @@ static bool textarea_replace_text(struct textarea *ta, unsigned int start, diff = end - start; /* find byte offset of replace start */ - for (b_start = 0; start-- > 0; + for (b_start = 0; start > 0; b_start = utf8_next(ta->text, ta->text_len, b_start)) ; /* do nothing */ @@ -608,7 +608,7 @@ static bool textarea_replace_text(struct textarea *ta, unsigned int start, /* Insert new text */ memcpy(ta->text + b_start, rep, rep_len); - ta->text_len += rep_len - (b_end - b_start); + ta->text_len += (int)rep_len - (b_end - b_start); ta->text_utf8_len = utf8_length(ta->text); textarea_normalise_text(ta, b_start, rep_len); @@ -763,36 +763,8 @@ bool textarea_set_caret(struct textarea *ta, int caret) /* Delete the old caret */ if (ta->caret_pos.char_off != -1) { - index = textarea_get_caret(ta); - if (index == -1) - return false; - - /* the redraw might happen in response to a text-change and - the caret position might be beyond the current text */ - if ((unsigned)index > c_len) - index = c_len; - - /* find byte offset of caret position */ - for (b_off = 0; index-- > 0; - b_off = utf8_next(ta->text, - ta->text_len, b_off)) - ; /* do nothing */ - - nsfont.font_width(&ta->fstyle, - ta->text + - ta->lines[ta->caret_pos.line].b_start, - b_off - ta->lines[ta->caret_pos.line].b_start, - &x); - - x += MARGIN_LEFT - ta->scroll_x; - - y = ta->line_height * ta->caret_pos.line - ta->scroll_y; - - /* set the caret coordinate beyond the redraw rectangle */ - ta->caret_x = x - 2; - - x0 = x - 1; - y0 = y + text_y_offset; + x0 = ta->caret_x - ta->scroll_x; + y0 = ta->caret_y - ta->scroll_y; width = 2; height = ta->line_height; -- cgit v1.2.3 From 694c1e7eeadccd40017ca22a95136f3895347ddf Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 10 Jan 2013 18:42:56 +0000 Subject: Fix silly. --- desktop/textarea.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 828503f69..9cec5b0d3 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -568,7 +568,7 @@ static bool textarea_replace_text(struct textarea *ta, unsigned int start, diff = end - start; /* find byte offset of replace start */ - for (b_start = 0; start > 0; + for (b_start = 0; start-- > 0; b_start = utf8_next(ta->text, ta->text_len, b_start)) ; /* do nothing */ -- cgit v1.2.3 From ab5d165659d0867213217f81794d985efa5d87c1 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 10 Jan 2013 19:43:22 +0000 Subject: More wrap behaviour improvement. --- desktop/textarea.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 9cec5b0d3..a12ed3282 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -301,7 +301,7 @@ static bool textarea_reflow(struct textarea *ta, unsigned int line) unsigned int len; size_t b_off; int x; - char *space; + char *space, *para_end; unsigned int line_count = 0; /** \todo pay attention to line parameter */ @@ -331,15 +331,22 @@ static bool textarea_reflow(struct textarea *ta, unsigned int line) for (len = ta->text_len - 1, text = ta->text; len > 0; len -= b_off, text += b_off) { - nsfont.font_split(&ta->fstyle, text, len, + /* Find end of paragraph */ + for (para_end = text; para_end < text + len; para_end++) { + if (*para_end == '\n') + break; + } + + /* Wrap current line in paragraph */ + nsfont.font_split(&ta->fstyle, text, para_end - text, ta->vis_width - MARGIN_LEFT - MARGIN_RIGHT, &b_off, &x); if (b_off == 0) { /* Text wasn't split */ - b_off = len; + b_off = para_end - text; } - /* b_off now marks space, or end of text */ + /* b_off now marks space, or end of paragraph */ if (line_count > 0 && line_count % LINE_CHUNK_SIZE == 0) { struct line_info *temp = realloc(ta->lines, @@ -353,19 +360,14 @@ static bool textarea_reflow(struct textarea *ta, unsigned int line) ta->lines = temp; } - /* handle LF */ - for (space = text; space <= text + b_off; space++) { - if (*space == '\n') - break; - } - /* space now marks newline, or b_off -- whichever's first */ - - if (space < text + b_off) { - /* Found newline; use it */ + if (para_end == text + b_off && *para_end == '\n') { + /* Not found any spaces to wrap at, and we + * have a newline char */ ta->lines[line_count].b_start = text - ta->text; - ta->lines[line_count++].b_length = space - text; + ta->lines[line_count++].b_length = para_end - text; - b_off = space + 1 - text; + /* Jump newline */ + b_off++; if (len - b_off == 0) { /* reached end of input => add last line */ -- cgit v1.2.3 From d7ddfd6ac3aff83498a10dc5fbe7ac792c533ebb Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 10 Jan 2013 22:07:11 +0000 Subject: Make logic compare clearer --- amiga/font.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/amiga/font.c b/amiga/font.c index ffecf85fe..33f71a926 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -156,7 +156,7 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle, for(i=0;i Date: Thu, 10 Jan 2013 23:20:42 +0000 Subject: Simplify routine to scroll ta so that caret is visible. --- desktop/textarea.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index a12ed3282..0d0542ed6 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -238,7 +238,6 @@ static bool textarea_select_fragment(struct textarea * ta) static bool textarea_scroll_visible(struct textarea *ta) { int x0, x1, y0, y1, x, y; - int index, b_off; bool scrolled = false; if (ta->caret_pos.char_off == -1) @@ -249,21 +248,8 @@ static bool textarea_scroll_visible(struct textarea *ta) y0 = 0; y1 = ta->vis_height; - index = textarea_get_caret(ta); - - /* find byte offset of caret position */ - for (b_off = 0; index-- > 0; - b_off = utf8_next(ta->text, ta->text_len, b_off)) - ; /* do nothing */ - - nsfont.font_width(&ta->fstyle, - ta->text + ta->lines[ta->caret_pos.line].b_start, - b_off - ta->lines[ta->caret_pos.line].b_start, - &x); - - /* top-left of caret */ - x += MARGIN_LEFT - ta->scroll_x; - y = ta->line_height * ta->caret_pos.line - ta->scroll_y; + x = ta->caret_x - ta->scroll_x; + y = ta->caret_y - ta->scroll_y; /* check and change vertical scroll */ if (y < y0) { -- cgit v1.2.3 From ac03806a50f292fc13930a2fdb3c8744bcaa954a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 10 Jan 2013 23:21:47 +0000 Subject: Fix redraw of caret when scroll offsets are non-zero, only caret has moved, and we're not getting a full textarea redraw. --- desktop/textarea.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop/textarea.c b/desktop/textarea.c index 0d0542ed6..16c2f4616 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -803,10 +803,14 @@ bool textarea_set_caret(struct textarea *ta, int caret) ta->caret_y = y; if (textarea_scroll_visible(ta)) { + /* Scrolled; redraw everything */ ta->redraw_request(ta->data, 0, 0, ta->vis_width, ta->vis_height); } else { + /* Just caret moved, redraw it */ + x -= ta->scroll_x; + y -= ta->scroll_y; x0 = max(x - 1, MARGIN_LEFT); y0 = max(y + text_y_offset, 0); x1 = min(x + 1, ta->vis_width - MARGIN_RIGHT); -- cgit v1.2.3 From 261528747c5423445398b5ee5ab6bc9c26b0d93b Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sat, 12 Jan 2013 02:35:09 +0000 Subject: Remove code that hasn't been used since 2004. --- .gitignore | 1 - Makefile.sources | 18 - utils/transtab | 1688 ------------------------------------------------------ utils/tt2code | 60 -- utils/utils.h | 1 - 5 files changed, 1768 deletions(-) delete mode 100644 utils/transtab delete mode 100755 utils/tt2code diff --git a/.gitignore b/.gitignore index 4002e540b..84eca230b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ windows/res/preferences test/nsurl test/urldbtest test/llcache -utils/translit.c utils/testament.h codedocs nsgtk diff --git a/Makefile.sources b/Makefile.sources index 32db5e666..a38290d14 100644 --- a/Makefile.sources +++ b/Makefile.sources @@ -74,21 +74,3 @@ S_BROWSER := $(addprefix desktop/,$(S_BROWSER)) content/fetchers/about.c: testament utils/testament.h desktop/version.c: testament utils/testament.h -# Some extra rules for building the transliteration table. -ifeq ($(HOST),riscos) -utils/translit.c: transtab - $(VQ)echo "TRANSTAB: utils/translit.c" - $(Q)dir utils - $(Q)$(PERL) tt2code < transtab > translit.c - $(Q)dir ^ -else -utils/translit.c: transtab - $(VQ)echo "TRANSTAB: utils/translit.c" - $(Q)cd utils; $(PERL) tt2code < transtab > translit.c -endif - -clean-intermediates: - $(VQ)echo " CLEAN: intermediates" - $(Q)$(RM) utils/translit.c - -CLEANS += clean-intermediates diff --git a/utils/transtab b/utils/transtab deleted file mode 100644 index ccb001757..000000000 --- a/utils/transtab +++ /dev/null @@ -1,1688 +0,0 @@ -% Source: http://www.cl.cam.ac.uk/~mgk25/unicode.html#libs -% -% "This package contains a table for transliterating ISO 10646 texts into -% best-effort representations using smaller coded character sets (ASCII, -% ISO 8859, etc.). It is primarily intended for inclusion into the GNU C -% library, but might be of use for other applications as well. The table -% is freely available to anyone." - -% APOSTROPHE - -% GRAVE ACCENT - ; -% NO-BREAK SPACE - -% INVERTED EXCLAMATION MARK - -% CENT SIGN - -% POUND SIGN - "" -% YEN SIGN - -% BROKEN BAR - -% SECTION SIGN - -% DIAERESIS - -% COPYRIGHT SIGN - ""; -% FEMININE ORDINAL INDICATOR - -% LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - "" -% NOT SIGN - -% SOFT HYPHEN - -% REGISTERED SIGN - "" -% MACRON - -% DEGREE SIGN - -% PLUS-MINUS SIGN - "" -% SUPERSCRIPT TWO - ""; -% SUPERSCRIPT THREE - ""; -% ACUTE ACCENT - -% MICRO SIGN - ; -% PILCROW SIGN - -% MIDDLE DOT - -% CEDILLA - -% SUPERSCRIPT ONE - ""; -% MASCULINE ORDINAL INDICATOR - -% RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - "" -% VULGAR FRACTION ONE QUARTER - "" -% VULGAR FRACTION ONE HALF - "" -% VULGAR FRACTION THREE QUARTERS - "" -% INVERTED QUESTION MARK - -% LATIN CAPITAL LETTER A WITH GRAVE - -% LATIN CAPITAL LETTER A WITH ACUTE - -% LATIN CAPITAL LETTER A WITH CIRCUMFLEX - -% LATIN CAPITAL LETTER A WITH TILDE - -% LATIN CAPITAL LETTER A WITH DIAERESIS - ""; -% LATIN CAPITAL LETTER A WITH RING ABOVE - ""; -% LATIN CAPITAL LETTER AE - ""; -% LATIN CAPITAL LETTER C WITH CEDILLA - -% LATIN CAPITAL LETTER E WITH GRAVE - -% LATIN CAPITAL LETTER E WITH ACUTE - -% LATIN CAPITAL LETTER E WITH CIRCUMFLEX - -% LATIN CAPITAL LETTER E WITH DIAERESIS - -% LATIN CAPITAL LETTER I WITH GRAVE - -% LATIN CAPITAL LETTER I WITH ACUTE - -% LATIN CAPITAL LETTER I WITH CIRCUMFLEX - -% LATIN CAPITAL LETTER I WITH DIAERESIS - -% LATIN CAPITAL LETTER ETH - -% LATIN CAPITAL LETTER N WITH TILDE - -% LATIN CAPITAL LETTER O WITH GRAVE - -% LATIN CAPITAL LETTER O WITH ACUTE - -% LATIN CAPITAL LETTER O WITH CIRCUMFLEX - -% LATIN CAPITAL LETTER O WITH TILDE - -% LATIN CAPITAL LETTER O WITH DIAERESIS - ""; -% MULTIPLICATION SIGN - -% LATIN CAPITAL LETTER O WITH STROKE - -% LATIN CAPITAL LETTER U WITH GRAVE - -% LATIN CAPITAL LETTER U WITH ACUTE - -% LATIN CAPITAL LETTER U WITH CIRCUMFLEX - -% LATIN CAPITAL LETTER U WITH DIAERESIS - ""; -% LATIN CAPITAL LETTER Y WITH ACUTE - -% LATIN CAPITAL LETTER THORN - "" -% LATIN SMALL LETTER SHARP S - ""; -% LATIN SMALL LETTER A WITH GRAVE - -% LATIN SMALL LETTER A WITH ACUTE - -% LATIN SMALL LETTER A WITH CIRCUMFLEX - -% LATIN SMALL LETTER A WITH TILDE - -% LATIN SMALL LETTER A WITH DIAERESIS - ""; -% LATIN SMALL LETTER A WITH RING ABOVE - ""; -% LATIN SMALL LETTER AE - ""; -% LATIN SMALL LETTER C WITH CEDILLA - -% LATIN SMALL LETTER E WITH GRAVE - -% LATIN SMALL LETTER E WITH ACUTE - -% LATIN SMALL LETTER E WITH CIRCUMFLEX - -% LATIN SMALL LETTER E WITH DIAERESIS - -% LATIN SMALL LETTER I WITH GRAVE - -% LATIN SMALL LETTER I WITH ACUTE - -% LATIN SMALL LETTER I WITH CIRCUMFLEX - -% LATIN SMALL LETTER I WITH DIAERESIS - -% LATIN SMALL LETTER ETH - -% LATIN SMALL LETTER N WITH TILDE - -% LATIN SMALL LETTER O WITH GRAVE - -% LATIN SMALL LETTER O WITH ACUTE - -% LATIN SMALL LETTER O WITH CIRCUMFLEX - -% LATIN SMALL LETTER O WITH TILDE - -% LATIN SMALL LETTER O WITH DIAERESIS - ""; -% DIVISION SIGN - -% LATIN SMALL LETTER O WITH STROKE - -% LATIN SMALL LETTER U WITH GRAVE - -% LATIN SMALL LETTER U WITH ACUTE - -% LATIN SMALL LETTER U WITH CIRCUMFLEX - -% LATIN SMALL LETTER U WITH DIAERESIS - ""; -% LATIN SMALL LETTER Y WITH ACUTE - -% LATIN SMALL LETTER THORN - "" -% LATIN SMALL LETTER Y WITH DIAERESIS - -% LATIN CAPITAL LETTER A WITH MACRON - -% LATIN SMALL LETTER A WITH MACRON - -% LATIN CAPITAL LETTER A WITH BREVE - -% LATIN SMALL LETTER A WITH BREVE - -% LATIN CAPITAL LETTER A WITH OGONEK - -% LATIN SMALL LETTER A WITH OGONEK - -% LATIN CAPITAL LETTER C WITH ACUTE - -% LATIN SMALL LETTER C WITH ACUTE - -% LATIN CAPITAL LETTER C WITH CIRCUMFLEX - ""; -% LATIN SMALL LETTER C WITH CIRCUMFLEX - ""; -% LATIN CAPITAL LETTER C WITH DOT ABOVE - -% LATIN SMALL LETTER C WITH DOT ABOVE - -% LATIN CAPITAL LETTER C WITH CARON - -% LATIN SMALL LETTER C WITH CARON - -% LATIN CAPITAL LETTER D WITH CARON - -% LATIN SMALL LETTER D WITH CARON - -% LATIN CAPITAL LETTER D WITH STROKE - -% LATIN SMALL LETTER D WITH STROKE - -% LATIN CAPITAL LETTER E WITH MACRON - -% LATIN SMALL LETTER E WITH MACRON - -% LATIN CAPITAL LETTER E WITH BREVE - -% LATIN SMALL LETTER E WITH BREVE - -% LATIN CAPITAL LETTER E WITH DOT ABOVE - -% LATIN SMALL LETTER E WITH DOT ABOVE - -% LATIN CAPITAL LETTER E WITH OGONEK - -% LATIN SMALL LETTER E WITH OGONEK - -% LATIN CAPITAL LETTER E WITH CARON - -% LATIN SMALL LETTER E WITH CARON - -% LATIN CAPITAL LETTER G WITH CIRCUMFLEX - ""; -% LATIN SMALL LETTER G WITH CIRCUMFLEX - ""; -% LATIN CAPITAL LETTER G WITH BREVE - -% LATIN SMALL LETTER G WITH BREVE - -% LATIN CAPITAL LETTER G WITH DOT ABOVE - -% LATIN SMALL LETTER G WITH DOT ABOVE - -% LATIN CAPITAL LETTER G WITH CEDILLA - -% LATIN SMALL LETTER G WITH CEDILLA - -% LATIN CAPITAL LETTER H WITH CIRCUMFLEX - ""; -% LATIN SMALL LETTER H WITH CIRCUMFLEX - ""; -% LATIN CAPITAL LETTER H WITH STROKE - -% LATIN SMALL LETTER H WITH STROKE - -% LATIN CAPITAL LETTER I WITH TILDE - -% LATIN SMALL LETTER I WITH TILDE - -% LATIN CAPITAL LETTER I WITH MACRON - -% LATIN SMALL LETTER I WITH MACRON - -% LATIN CAPITAL LETTER I WITH BREVE - -% LATIN SMALL LETTER I WITH BREVE - -% LATIN CAPITAL LETTER I WITH OGONEK - -% LATIN SMALL LETTER I WITH OGONEK - -% LATIN CAPITAL LETTER I WITH DOT ABOVE - -% LATIN SMALL LETTER DOTLESS I - -% LATIN CAPITAL LIGATURE IJ - "" -% LATIN SMALL LIGATURE IJ - "" -% LATIN CAPITAL LETTER J WITH CIRCUMFLEX - ""; -% LATIN SMALL LETTER J WITH CIRCUMFLEX - ""; -% LATIN CAPITAL LETTER K WITH CEDILLA - -% LATIN SMALL LETTER K WITH CEDILLA - -% LATIN SMALL LETTER KRA - -% LATIN CAPITAL LETTER L WITH ACUTE - -% LATIN SMALL LETTER L WITH ACUTE - -% LATIN CAPITAL LETTER L WITH CEDILLA - -% LATIN SMALL LETTER L WITH CEDILLA - -% LATIN CAPITAL LETTER L WITH CARON - -% LATIN SMALL LETTER L WITH CARON - -% LATIN CAPITAL LETTER L WITH MIDDLE DOT - "";""; -% LATIN SMALL LETTER L WITH MIDDLE DOT - "";""; -% LATIN CAPITAL LETTER L WITH STROKE - -% LATIN SMALL LETTER L WITH STROKE - -% LATIN CAPITAL LETTER N WITH ACUTE - -% LATIN SMALL LETTER N WITH ACUTE - -% LATIN CAPITAL LETTER N WITH CEDILLA - -% LATIN SMALL LETTER N WITH CEDILLA - -% LATIN CAPITAL LETTER N WITH CARON - -% LATIN SMALL LETTER N WITH CARON - -% LATIN SMALL LETTER N PRECEDED BY APOSTROPHE - "" -% LATIN CAPITAL LETTER ENG - ""; -% LATIN SMALL LETTER ENG - ""; -% LATIN CAPITAL LETTER O WITH MACRON - -% LATIN SMALL LETTER O WITH MACRON - -% LATIN CAPITAL LETTER O WITH BREVE - -% LATIN SMALL LETTER O WITH BREVE - -% LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - -% LATIN SMALL LETTER O WITH DOUBLE ACUTE - -% LATIN CAPITAL LIGATURE OE - ;"" -% LATIN SMALL LIGATURE OE - ;"" -% LATIN CAPITAL LETTER R WITH ACUTE - -% LATIN SMALL LETTER R WITH ACUTE - -% LATIN CAPITAL LETTER R WITH CEDILLA - -% LATIN SMALL LETTER R WITH CEDILLA - -% LATIN CAPITAL LETTER R WITH CARON - -% LATIN SMALL LETTER R WITH CARON - -% LATIN CAPITAL LETTER S WITH ACUTE - -% LATIN SMALL LETTER S WITH ACUTE - -% LATIN CAPITAL LETTER S WITH CIRCUMFLEX - ""; -% LATIN SMALL LETTER S WITH CIRCUMFLEX - ""; -% LATIN CAPITAL LETTER S WITH CEDILLA - -% LATIN SMALL LETTER S WITH CEDILLA - -% LATIN CAPITAL LETTER S WITH CARON - -% LATIN SMALL LETTER S WITH CARON - -% LATIN CAPITAL LETTER T WITH CEDILLA - -% LATIN SMALL LETTER T WITH CEDILLA - -% LATIN CAPITAL LETTER T WITH CARON - -% LATIN SMALL LETTER T WITH CARON - -% LATIN CAPITAL LETTER T WITH STROKE - -% LATIN SMALL LETTER T WITH STROKE - -% LATIN CAPITAL LETTER U WITH TILDE - -% LATIN SMALL LETTER U WITH TILDE - -% LATIN CAPITAL LETTER U WITH MACRON - -% LATIN SMALL LETTER U WITH MACRON - -% LATIN CAPITAL LETTER U WITH BREVE - -% LATIN SMALL LETTER U WITH BREVE - -% LATIN CAPITAL LETTER U WITH RING ABOVE - -% LATIN SMALL LETTER U WITH RING ABOVE - -% LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - -% LATIN SMALL LETTER U WITH DOUBLE ACUTE - -% LATIN CAPITAL LETTER U WITH OGONEK - -% LATIN SMALL LETTER U WITH OGONEK - -% LATIN CAPITAL LETTER W WITH CIRCUMFLEX - ; -% LATIN SMALL LETTER W WITH CIRCUMFLEX - ; -% LATIN CAPITAL LETTER Y WITH CIRCUMFLEX - ; -% LATIN SMALL LETTER Y WITH CIRCUMFLEX - ; -% LATIN CAPITAL LETTER Y WITH DIAERESIS - -% LATIN CAPITAL LETTER Z WITH ACUTE - -% LATIN SMALL LETTER Z WITH ACUTE - -% LATIN CAPITAL LETTER Z WITH DOT ABOVE - -% LATIN SMALL LETTER Z WITH DOT ABOVE - -% LATIN CAPITAL LETTER Z WITH CARON - -% LATIN SMALL LETTER Z WITH CARON - -% LATIN SMALL LETTER LONG S - -% LATIN SMALL LETTER F WITH HOOK - -% LATIN CAPITAL LETTER S WITH COMMA BELOW - ; -% LATIN SMALL LETTER S WITH COMMA BELOW - ; -% LATIN CAPITAL LETTER T WITH COMMA BELOW - ; -% LATIN SMALL LETTER T WITH COMMA BELOW - ; -% MODIFIER LETTER PRIME - ; -% MODIFIER LETTER TURNED COMMA - -% MODIFIER LETTER APOSTROPHE - ; -% MODIFIER LETTER REVERSED COMMA - -% MODIFIER LETTER CIRCUMFLEX ACCENT - -% MODIFIER LETTER VERTICAL LINE - -% MODIFIER LETTER MACRON - -% MODIFIER LETTER LOW VERTICAL LINE - -% MODIFIER LETTER TRIANGULAR COLON - -% RING ABOVE - -% SMALL TILDE - -% DOUBLE ACUTE ACCENT - -% GREEK NUMERAL SIGN - -% GREEK LOWER NUMERAL SIGN - -% GREEK QUESTION MARK - -% LATIN CAPITAL LETTER B WITH DOT ABOVE - -% LATIN SMALL LETTER B WITH DOT ABOVE - -% LATIN CAPITAL LETTER D WITH DOT ABOVE - -% LATIN SMALL LETTER D WITH DOT ABOVE - -% LATIN CAPITAL LETTER F WITH DOT ABOVE - -% LATIN SMALL LETTER F WITH DOT ABOVE - -% LATIN CAPITAL LETTER M WITH DOT ABOVE - -% LATIN SMALL LETTER M WITH DOT ABOVE - -% LATIN CAPITAL LETTER P WITH DOT ABOVE - -% LATIN SMALL LETTER P WITH DOT ABOVE - -% LATIN CAPITAL LETTER S WITH DOT ABOVE - -% LATIN SMALL LETTER S WITH DOT ABOVE - -% LATIN CAPITAL LETTER T WITH DOT ABOVE - -% LATIN SMALL LETTER T WITH DOT ABOVE - -% LATIN CAPITAL LETTER W WITH GRAVE - -% LATIN SMALL LETTER W WITH GRAVE - -% LATIN CAPITAL LETTER W WITH ACUTE - -% LATIN SMALL LETTER W WITH ACUTE - -% LATIN CAPITAL LETTER W WITH DIAERESIS - -% LATIN SMALL LETTER W WITH DIAERESIS - -% LATIN CAPITAL LETTER Y WITH GRAVE - -% LATIN SMALL LETTER Y WITH GRAVE - -% EN QUAD - -% EM QUAD - "" -% EN SPACE - -% EM SPACE - "" -% THREE-PER-EM SPACE - -% FOUR-PER-EM SPACE - -% SIX-PER-EM SPACE - -% FIGURE SPACE - -% PUNCTUATION SPACE - -% THIN SPACE - -% HAIR SPACE - "" -% ZERO WIDTH SPACE - "" -% ZERO WIDTH NON-JOINER - "" -% ZERO WIDTH JOINER - "" -% LEFT-TO-RIGHT MARK - "" -% RIGHT-TO-LEFT MARK - "" -% HYPHEN - -% NON-BREAKING HYPHEN - -% FIGURE DASH - -% EN DASH - ; -% EM DASH - ;"" -% HORIZONTAL BAR - "" -% DOUBLE VERTICAL LINE - "" -% DOUBLE LOW LINE - -% LEFT SINGLE QUOTATION MARK - ; -% RIGHT SINGLE QUOTATION MARK - ; -% SINGLE LOW-9 QUOTATION MARK - -% SINGLE HIGH-REVERSED-9 QUOTATION MARK - -% LEFT DOUBLE QUOTATION MARK - ; -% RIGHT DOUBLE QUOTATION MARK - ; -% DOUBLE LOW-9 QUOTATION MARK - ; -% DOUBLE HIGH-REVERSED-9 QUOTATION MARK - -% DAGGER - ; -% DOUBLE DAGGER - ;"" -% BULLET - ; -% TRIANGULAR BULLET - -% ONE DOT LEADER - -% TWO DOT LEADER - "" -% HORIZONTAL ELLIPSIS - ;"" -% HYPHENATION POINT - -% LEFT-TO-RIGHT EMBEDDING - "" -% RIGHT-TO-LEFT EMBEDDING - "" -% POP DIRECTIONAL FORMATTING - "" -% LEFT-TO-RIGHT OVERRIDE - "" -% RIGHT-TO-LEFT OVERRIDE - "" -% NARROW NO-BREAK SPACE - -% PER MILLE SIGN - ;"" -% PRIME - -% DOUBLE PRIME - -% TRIPLE PRIME - "" -% REVERSED PRIME - -% REVERSED DOUBLE PRIME - "" -% REVERSED TRIPLE PRIME - "" -% SINGLE LEFT-POINTING ANGLE QUOTATION MARK - ; -% SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - ; -% DOUBLE EXCLAMATION MARK - "" -% OVERLINE - -% HYPHEN BULLET - -% FRACTION SLASH - -% QUESTION EXCLAMATION MARK - "" -% EXCLAMATION QUESTION MARK - "" -% TIRONIAN SIGN ET - -% SUPERSCRIPT ZERO - ""; -% SUPERSCRIPT FOUR - ""; -% SUPERSCRIPT FIVE - ""; -% SUPERSCRIPT SIX - ""; -% SUPERSCRIPT SEVEN - ""; -% SUPERSCRIPT EIGHT - ""; -% SUPERSCRIPT NINE - ""; -% SUPERSCRIPT PLUS SIGN - ""; -% SUPERSCRIPT MINUS - ""; -% SUPERSCRIPT EQUALS SIGN - ""; -% SUPERSCRIPT LEFT PARENTHESIS - ""; -% SUPERSCRIPT RIGHT PARENTHESIS - ""; -% SUPERSCRIPT LATIN SMALL LETTER N - ""; -% SUBSCRIPT ZERO - ""; -% SUBSCRIPT ONE - ""; -% SUBSCRIPT TWO - ""; -% SUBSCRIPT THREE - ""; -% SUBSCRIPT FOUR - ""; -% SUBSCRIPT FIVE - ""; -% SUBSCRIPT SIX - ""; -% SUBSCRIPT SEVEN - ""; -% SUBSCRIPT EIGHT - ""; -% SUBSCRIPT NINE - ""; -% SUBSCRIPT PLUS SIGN - ""; -% SUBSCRIPT MINUS - ""; -% SUBSCRIPT EQUALS SIGN - ""; -% SUBSCRIPT LEFT PARENTHESIS - ""; -% SUBSCRIPT RIGHT PARENTHESIS - ""; -% EURO SIGN - ;""; -% ACCOUNT OF - "" -% ADDRESSED TO THE SUBJECT - "" -% DEGREE CELSIUS - ""; -% CARE OF - "" -% CADA UNA - "" -% DEGREE FAHRENHEIT - ""; -% SCRIPT SMALL L - -% NUMERO SIGN - "";"" -% SOUND RECORDING COPYRIGHT - "" -% SERVICE MARK - "" -% TELEPHONE SIGN - "" -% TRADE MARK SIGN - ;"" -% OHM SIGN - ;""; -% KELVIN SIGN - -% ANGSTROM SIGN - -% ESTIMATED SYMBOL - -% VULGAR FRACTION ONE THIRD - "" -% VULGAR FRACTION TWO THIRDS - "" -% VULGAR FRACTION ONE FIFTH - "" -% VULGAR FRACTION TWO FIFTHS - "" -% VULGAR FRACTION THREE FIFTHS - "" -% VULGAR FRACTION FOUR FIFTHS - "" -% VULGAR FRACTION ONE SIXTH - "" -% VULGAR FRACTION FIVE SIXTHS - "" -% VULGAR FRACTION ONE EIGHTH - "" -% VULGAR FRACTION THREE EIGHTHS - "" -% VULGAR FRACTION FIVE EIGHTHS - "" -% VULGAR FRACTION SEVEN EIGHTHS - "" -% FRACTION NUMERATOR ONE - "" -% ROMAN NUMERAL ONE - -% ROMAN NUMERAL TWO - "" -% ROMAN NUMERAL THREE - "" -% ROMAN NUMERAL FOUR - "" -% ROMAN NUMERAL FIVE - -% ROMAN NUMERAL SIX - "" -% ROMAN NUMERAL SEVEN - "" -% ROMAN NUMERAL EIGHT - "" -% ROMAN NUMERAL NINE - "" -% ROMAN NUMERAL TEN - -% ROMAN NUMERAL ELEVEN - "" -% ROMAN NUMERAL TWELVE - "" -% ROMAN NUMERAL FIFTY - -% ROMAN NUMERAL ONE HUNDRED - -% ROMAN NUMERAL FIVE HUNDRED - -% ROMAN NUMERAL ONE THOUSAND - -% SMALL ROMAN NUMERAL ONE - -% SMALL ROMAN NUMERAL TWO - "" -% SMALL ROMAN NUMERAL THREE - "" -% SMALL ROMAN NUMERAL FOUR - "" -% SMALL ROMAN NUMERAL FIVE - -% SMALL ROMAN NUMERAL SIX - "" -% SMALL ROMAN NUMERAL SEVEN - "" -% SMALL ROMAN NUMERAL EIGHT - "" -% SMALL ROMAN NUMERAL NINE - "" -% SMALL ROMAN NUMERAL TEN - -% SMALL ROMAN NUMERAL ELEVEN - "" -% SMALL ROMAN NUMERAL TWELVE - "" -% SMALL ROMAN NUMERAL FIFTY - -% SMALL ROMAN NUMERAL ONE HUNDRED - -% SMALL ROMAN NUMERAL FIVE HUNDRED - -% SMALL ROMAN NUMERAL ONE THOUSAND - -% LEFTWARDS ARROW - "" -% UPWARDS ARROW - -% RIGHTWARDS ARROW - "" -% DOWNWARDS ARROW - -% LEFT RIGHT ARROW - "" -% LEFTWARDS DOUBLE ARROW - "" -% RIGHTWARDS DOUBLE ARROW - "" -% LEFT RIGHT DOUBLE ARROW - "" -% MINUS SIGN - ;; -% DIVISION SLASH - -% SET MINUS - -% ASTERISK OPERATOR - -% RING OPERATOR - -% BULLET OPERATOR - -% INFINITY - "" -% DIVIDES - -% PARALLEL TO - "" -% RATIO - -% TILDE OPERATOR - -% NOT EQUAL TO - "" -% IDENTICAL TO - -% LESS-THAN OR EQUAL TO - "" -% GREATER-THAN OR EQUAL TO - "" -% MUCH LESS-THAN - "" -% MUCH GREATER-THAN - "" -% CIRCLED PLUS - "" -% CIRCLED MINUS - "" -% CIRCLED TIMES - "" -% CIRCLED DIVISION SLASH - "" -% RIGHT TACK - "" -% LEFT TACK - "" -% ASSERTION - "" -% MODELS - "" -% TRUE - "" -% FORCES - "" -% DOT OPERATOR - -% STAR OPERATOR - -% EQUAL AND PARALLEL TO - -% VERY MUCH LESS-THAN - "" -% VERY MUCH GREATER-THAN - "" -% MIDLINE HORIZONTAL ELLIPSIS - "" -% LEFT-POINTING ANGLE BRACKET - -% RIGHT-POINTING ANGLE BRACKET - -% SYMBOL FOR NULL - "" -% SYMBOL FOR START OF HEADING - "" -% SYMBOL FOR START OF TEXT - "" -% SYMBOL FOR END OF TEXT - "" -% SYMBOL FOR END OF TRANSMISSION - "" -% SYMBOL FOR ENQUIRY - "" -% SYMBOL FOR ACKNOWLEDGE - "" -% SYMBOL FOR BELL - "" -% SYMBOL FOR BACKSPACE - "" -% SYMBOL FOR HORIZONTAL TABULATION - "" -% SYMBOL FOR LINE FEED - "" -% SYMBOL FOR VERTICAL TABULATION - "" -% SYMBOL FOR FORM FEED - "" -% SYMBOL FOR CARRIAGE RETURN - "" -% SYMBOL FOR SHIFT OUT - "" -% SYMBOL FOR SHIFT IN - "" -% SYMBOL FOR DATA LINK ESCAPE - "" -% SYMBOL FOR DEVICE CONTROL ONE - "" -% SYMBOL FOR DEVICE CONTROL TWO - "" -% SYMBOL FOR DEVICE CONTROL THREE - "" -% SYMBOL FOR DEVICE CONTROL FOUR - "" -% SYMBOL FOR NEGATIVE ACKNOWLEDGE - "" -% SYMBOL FOR SYNCHRONOUS IDLE - "" -% SYMBOL FOR END OF TRANSMISSION BLOCK - "" -% SYMBOL FOR CANCEL - "" -% SYMBOL FOR END OF MEDIUM - "" -% SYMBOL FOR SUBSTITUTE - "" -% SYMBOL FOR ESCAPE - "" -% SYMBOL FOR FILE SEPARATOR - "" -% SYMBOL FOR GROUP SEPARATOR - "" -% SYMBOL FOR RECORD SEPARATOR - "" -% SYMBOL FOR UNIT SEPARATOR - "" -% SYMBOL FOR SPACE - "" -% SYMBOL FOR DELETE - "" -% OPEN BOX - -% SYMBOL FOR NEWLINE - "" -% SYMBOL FOR DELETE FORM TWO - "" -% SYMBOL FOR SUBSTITUTE FORM TWO - -% CIRCLED DIGIT ONE - ""; -% CIRCLED DIGIT TWO - ""; -% CIRCLED DIGIT THREE - ""; -% CIRCLED DIGIT FOUR - ""; -% CIRCLED DIGIT FIVE - ""; -% CIRCLED DIGIT SIX - ""; -% CIRCLED DIGIT SEVEN - ""; -% CIRCLED DIGIT EIGHT - ""; -% CIRCLED DIGIT NINE - ""; -% CIRCLED NUMBER TEN - "" -% CIRCLED NUMBER ELEVEN - "" -% CIRCLED NUMBER TWELVE - "" -% CIRCLED NUMBER THIRTEEN - "" -% CIRCLED NUMBER FOURTEEN - "" -% CIRCLED NUMBER FIFTEEN - "" -% CIRCLED NUMBER SIXTEEN - "" -% CIRCLED NUMBER SEVENTEEN - "" -% CIRCLED NUMBER EIGHTEEN - "" -% CIRCLED NUMBER NINETEEN - "" -% CIRCLED NUMBER TWENTY - "" -% PARENTHESIZED DIGIT ONE - ""; -% PARENTHESIZED DIGIT TWO - ""; -% PARENTHESIZED DIGIT THREE - ""; -% PARENTHESIZED DIGIT FOUR - ""; -% PARENTHESIZED DIGIT FIVE - ""; -% PARENTHESIZED DIGIT SIX - ""; -% PARENTHESIZED DIGIT SEVEN - ""; -% PARENTHESIZED DIGIT EIGHT - ""; -% PARENTHESIZED DIGIT NINE - ""; -% PARENTHESIZED NUMBER TEN - "" -% PARENTHESIZED NUMBER ELEVEN - "" -% PARENTHESIZED NUMBER TWELVE - "" -% PARENTHESIZED NUMBER THIRTEEN - "" -% PARENTHESIZED NUMBER FOURTEEN - "" -% PARENTHESIZED NUMBER FIFTEEN - "" -% PARENTHESIZED NUMBER SIXTEEN - "" -% PARENTHESIZED NUMBER SEVENTEEN - "" -% PARENTHESIZED NUMBER EIGHTEEN - "" -% PARENTHESIZED NUMBER NINETEEN - "" -% PARENTHESIZED NUMBER TWENTY - "" -% DIGIT ONE FULL STOP - ""; -% DIGIT TWO FULL STOP - ""; -% DIGIT THREE FULL STOP - ""; -% DIGIT FOUR FULL STOP - ""; -% DIGIT FIVE FULL STOP - ""; -% DIGIT SIX FULL STOP - ""; -% DIGIT SEVEN FULL STOP - ""; -% DIGIT EIGHT FULL STOP - ""; -% DIGIT NINE FULL STOP - ""; -% NUMBER TEN FULL STOP - "" -% NUMBER ELEVEN FULL STOP - "" -% NUMBER TWELVE FULL STOP - "" -% NUMBER THIRTEEN FULL STOP - "" -% NUMBER FOURTEEN FULL STOP - "" -% NUMBER FIFTEEN FULL STOP - "" -% NUMBER SIXTEEN FULL STOP - "" -% NUMBER SEVENTEEN FULL STOP - "" -% NUMBER EIGHTEEN FULL STOP - "" -% NUMBER NINETEEN FULL STOP - "" -% NUMBER TWENTY FULL STOP - "" -% PARENTHESIZED LATIN SMALL LETTER A - ""; -% PARENTHESIZED LATIN SMALL LETTER B - ""; -% PARENTHESIZED LATIN SMALL LETTER C - ""; -% PARENTHESIZED LATIN SMALL LETTER D - ""; -% PARENTHESIZED LATIN SMALL LETTER E - ""; -% PARENTHESIZED LATIN SMALL LETTER F - ""; -% PARENTHESIZED LATIN SMALL LETTER G - ""; -% PARENTHESIZED LATIN SMALL LETTER H - ""; -% PARENTHESIZED LATIN SMALL LETTER I - ""; -% PARENTHESIZED LATIN SMALL LETTER J - ""; -% PARENTHESIZED LATIN SMALL LETTER K - ""; -% PARENTHESIZED LATIN SMALL LETTER L - ""; -% PARENTHESIZED LATIN SMALL LETTER M - ""; -% PARENTHESIZED LATIN SMALL LETTER N - ""; -% PARENTHESIZED LATIN SMALL LETTER O - ""; -% PARENTHESIZED LATIN SMALL LETTER P - ""; -% PARENTHESIZED LATIN SMALL LETTER Q - ""; -% PARENTHESIZED LATIN SMALL LETTER R - ""; -% PARENTHESIZED LATIN SMALL LETTER S - ""; -% PARENTHESIZED LATIN SMALL LETTER T - ""; -% PARENTHESIZED LATIN SMALL LETTER U - ""; -% PARENTHESIZED LATIN SMALL LETTER V - ""; -% PARENTHESIZED LATIN SMALL LETTER W - ""; -% PARENTHESIZED LATIN SMALL LETTER X - ""; -% PARENTHESIZED LATIN SMALL LETTER Y - ""; -% PARENTHESIZED LATIN SMALL LETTER Z - ""; -% CIRCLED LATIN CAPITAL LETTER A - ""; -% CIRCLED LATIN CAPITAL LETTER B - ""; -% CIRCLED LATIN CAPITAL LETTER C - ""; -% CIRCLED LATIN CAPITAL LETTER D - ""; -% CIRCLED LATIN CAPITAL LETTER E - ""; -% CIRCLED LATIN CAPITAL LETTER F - ""; -% CIRCLED LATIN CAPITAL LETTER G - ""; -% CIRCLED LATIN CAPITAL LETTER H - ""; -% CIRCLED LATIN CAPITAL LETTER I - ""; -% CIRCLED LATIN CAPITAL LETTER J - ""; -% CIRCLED LATIN CAPITAL LETTER K - ""; -% CIRCLED LATIN CAPITAL LETTER L - ""; -% CIRCLED LATIN CAPITAL LETTER M - ""; -% CIRCLED LATIN CAPITAL LETTER N - ""; -% CIRCLED LATIN CAPITAL LETTER O - ""; -% CIRCLED LATIN CAPITAL LETTER P - ""; -% CIRCLED LATIN CAPITAL LETTER Q - ""; -% CIRCLED LATIN CAPITAL LETTER R - ""; -% CIRCLED LATIN CAPITAL LETTER S - ""; -% CIRCLED LATIN CAPITAL LETTER T - ""; -% CIRCLED LATIN CAPITAL LETTER U - ""; -% CIRCLED LATIN CAPITAL LETTER V - ""; -% CIRCLED LATIN CAPITAL LETTER W - ""; -% CIRCLED LATIN CAPITAL LETTER X - ""; -% CIRCLED LATIN CAPITAL LETTER Y - ""; -% CIRCLED LATIN CAPITAL LETTER Z - ""; -% CIRCLED LATIN SMALL LETTER A - ""; -% CIRCLED LATIN SMALL LETTER B - ""; -% CIRCLED LATIN SMALL LETTER C - ""; -% CIRCLED LATIN SMALL LETTER D - ""; -% CIRCLED LATIN SMALL LETTER E - ""; -% CIRCLED LATIN SMALL LETTER F - ""; -% CIRCLED LATIN SMALL LETTER G - ""; -% CIRCLED LATIN SMALL LETTER H - ""; -% CIRCLED LATIN SMALL LETTER I - ""; -% CIRCLED LATIN SMALL LETTER J - ""; -% CIRCLED LATIN SMALL LETTER K - ""; -% CIRCLED LATIN SMALL LETTER L - ""; -% CIRCLED LATIN SMALL LETTER M - ""; -% CIRCLED LATIN SMALL LETTER N - ""; -% CIRCLED LATIN SMALL LETTER O - ""; -% CIRCLED LATIN SMALL LETTER P - ""; -% CIRCLED LATIN SMALL LETTER Q - ""; -% CIRCLED LATIN SMALL LETTER R - ""; -% CIRCLED LATIN SMALL LETTER S - ""; -% CIRCLED LATIN SMALL LETTER T - ""; -% CIRCLED LATIN SMALL LETTER U - ""; -% CIRCLED LATIN SMALL LETTER V - ""; -% CIRCLED LATIN SMALL LETTER W - ""; -% CIRCLED LATIN SMALL LETTER X - ""; -% CIRCLED LATIN SMALL LETTER Y - ""; -% CIRCLED LATIN SMALL LETTER Z - ""; -% CIRCLED DIGIT ZERO - ""; -% BOX DRAWINGS LIGHT HORIZONTAL - -% BOX DRAWINGS HEAVY HORIZONTAL - -% BOX DRAWINGS LIGHT VERTICAL - -% BOX DRAWINGS HEAVY VERTICAL - -% BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL - -% BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL - -% BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL - -% BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL - -% BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL - -% BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL - -% BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL - -% BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL - -% BOX DRAWINGS LIGHT DOWN AND RIGHT - -% BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY - -% BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT - -% BOX DRAWINGS HEAVY DOWN AND RIGHT - -% BOX DRAWINGS LIGHT DOWN AND LEFT - -% BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY - -% BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT - -% BOX DRAWINGS HEAVY DOWN AND LEFT - -% BOX DRAWINGS LIGHT UP AND RIGHT - -% BOX DRAWINGS UP LIGHT AND RIGHT HEAVY - -% BOX DRAWINGS UP HEAVY AND RIGHT LIGHT - -% BOX DRAWINGS HEAVY UP AND RIGHT - -% BOX DRAWINGS LIGHT UP AND LEFT - -% BOX DRAWINGS UP LIGHT AND LEFT HEAVY - -% BOX DRAWINGS UP HEAVY AND LEFT LIGHT - -% BOX DRAWINGS HEAVY UP AND LEFT - -% BOX DRAWINGS LIGHT VERTICAL AND RIGHT - -% BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY - -% BOX DRAWINGS UP HEAVY AND RIGHT DOWN LIGHT - -% BOX DRAWINGS DOWN HEAVY AND RIGHT UP LIGHT - -% BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT - -% BOX DRAWINGS DOWN LIGHT AND RIGHT UP HEAVY - -% BOX DRAWINGS UP LIGHT AND RIGHT DOWN HEAVY - -% BOX DRAWINGS HEAVY VERTICAL AND RIGHT - -% BOX DRAWINGS LIGHT VERTICAL AND LEFT - -% BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY - -% BOX DRAWINGS UP HEAVY AND LEFT DOWN LIGHT - -% BOX DRAWINGS DOWN HEAVY AND LEFT UP LIGHT - -% BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT - -% BOX DRAWINGS DOWN LIGHT AND LEFT UP HEAVY - -% BOX DRAWINGS UP LIGHT AND LEFT DOWN HEAVY - -% BOX DRAWINGS HEAVY VERTICAL AND LEFT - -% BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - -% BOX DRAWINGS LEFT HEAVY AND RIGHT DOWN LIGHT - -% BOX DRAWINGS RIGHT HEAVY AND LEFT DOWN LIGHT - -% BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY - -% BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT - -% BOX DRAWINGS RIGHT LIGHT AND LEFT DOWN HEAVY - -% BOX DRAWINGS LEFT LIGHT AND RIGHT DOWN HEAVY - -% BOX DRAWINGS HEAVY DOWN AND HORIZONTAL - -% BOX DRAWINGS LIGHT UP AND HORIZONTAL - -% BOX DRAWINGS LEFT HEAVY AND RIGHT UP LIGHT - -% BOX DRAWINGS RIGHT HEAVY AND LEFT UP LIGHT - -% BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY - -% BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT - -% BOX DRAWINGS RIGHT LIGHT AND LEFT UP HEAVY - -% BOX DRAWINGS LEFT LIGHT AND RIGHT UP HEAVY - -% BOX DRAWINGS HEAVY UP AND HORIZONTAL - -% BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - -% BOX DRAWINGS LEFT HEAVY AND RIGHT VERTICAL LIGHT - -% BOX DRAWINGS RIGHT HEAVY AND LEFT VERTICAL LIGHT - -% BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY - -% BOX DRAWINGS UP HEAVY AND DOWN HORIZONTAL LIGHT - -% BOX DRAWINGS DOWN HEAVY AND UP HORIZONTAL LIGHT - -% BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT - -% BOX DRAWINGS LEFT UP HEAVY AND RIGHT DOWN LIGHT - -% BOX DRAWINGS RIGHT UP HEAVY AND LEFT DOWN LIGHT - -% BOX DRAWINGS LEFT DOWN HEAVY AND RIGHT UP LIGHT - -% BOX DRAWINGS RIGHT DOWN HEAVY AND LEFT UP LIGHT - -% BOX DRAWINGS DOWN LIGHT AND UP HORIZONTAL HEAVY - -% BOX DRAWINGS UP LIGHT AND DOWN HORIZONTAL HEAVY - -% BOX DRAWINGS RIGHT LIGHT AND LEFT VERTICAL HEAVY - -% BOX DRAWINGS LEFT LIGHT AND RIGHT VERTICAL HEAVY - -% BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL - -% BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL - -% BOX DRAWINGS HEAVY DOUBLE DASH HORIZONTAL - -% BOX DRAWINGS LIGHT DOUBLE DASH VERTICAL - -% BOX DRAWINGS HEAVY DOUBLE DASH VERTICAL - -% BOX DRAWINGS DOUBLE HORIZONTAL - -% BOX DRAWINGS DOUBLE VERTICAL - -% BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - -% BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - -% BOX DRAWINGS DOUBLE DOWN AND RIGHT - -% BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - -% BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - -% BOX DRAWINGS DOUBLE DOWN AND LEFT - -% BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - -% BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - -% BOX DRAWINGS DOUBLE UP AND RIGHT - -% BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - -% BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - -% BOX DRAWINGS DOUBLE UP AND LEFT - -% BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - -% BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - -% BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - -% BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - -% BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - -% BOX DRAWINGS DOUBLE VERTICAL AND LEFT - -% BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - -% BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - -% BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - -% BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - -% BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - -% BOX DRAWINGS DOUBLE UP AND HORIZONTAL - -% BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - -% BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - -% BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - -% BOX DRAWINGS LIGHT ARC DOWN AND RIGHT - -% BOX DRAWINGS LIGHT ARC DOWN AND LEFT - -% BOX DRAWINGS LIGHT ARC UP AND LEFT - -% BOX DRAWINGS LIGHT ARC UP AND RIGHT - -% BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT - -% BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT - -% BOX DRAWINGS LIGHT DIAGONAL CROSS - -% BOX DRAWINGS LIGHT LEFT AND HEAVY RIGHT - -% BOX DRAWINGS LIGHT UP AND HEAVY DOWN - -% BOX DRAWINGS HEAVY LEFT AND LIGHT RIGHT - -% BOX DRAWINGS HEAVY UP AND LIGHT DOWN - -% WHITE CIRCLE - -% WHITE BULLET - -% BLACK STAR - -% WHITE STAR - -% BALLOT BOX WITH X - -% SALTIRE - -% WHITE FROWNING FACE - "" -% WHITE SMILING FACE - "" -% BLACK SMILING FACE - "" -% MUSIC FLAT SIGN - -% MUSIC SHARP SIGN - -% UPPER BLADE SCISSORS - "" -% BLACK SCISSORS - "" -% LOWER BLADE SCISSORS - "" -% WHITE SCISSORS - "" -% VICTORY HAND - -% CHECK MARK - -% HEAVY CHECK MARK - -% MULTIPLICATION X - -% HEAVY MULTIPLICATION X - -% BALLOT X - -% HEAVY BALLOT X - -% OUTLINED GREEK CROSS - -% HEAVY GREEK CROSS - -% OPEN CENTRE CROSS - -% HEAVY OPEN CENTRE CROSS - -% LATIN CROSS - -% SHADOWED WHITE LATIN CROSS - -% OUTLINED LATIN CROSS - -% MALTESE CROSS - -% STAR OF DAVID - -% FOUR TEARDROP-SPOKED ASTERISK - -% FOUR BALLOON-SPOKED ASTERISK - -% HEAVY FOUR BALLOON-SPOKED ASTERISK - -% FOUR CLUB-SPOKED ASTERISK - -% BLACK FOUR POINTED STAR - -% WHITE FOUR POINTED STAR - -% STRESS OUTLINED WHITE STAR - -% CIRCLED WHITE STAR - -% OPEN CENTRE BLACK STAR - -% BLACK CENTRE WHITE STAR - -% OUTLINED BLACK STAR - -% HEAVY OUTLINED BLACK STAR - -% PINWHEEL STAR - -% SHADOWED WHITE STAR - -% HEAVY ASTERISK - -% OPEN CENTRE ASTERISK - -% EIGHT SPOKED ASTERISK - -% EIGHT POINTED BLACK STAR - -% EIGHT POINTED PINWHEEL STAR - -% SIX POINTED BLACK STAR - -% EIGHT POINTED RECTILINEAR BLACK STAR - -% HEAVY EIGHT POINTED RECTILINEAR BLACK STAR - -% TWELVE POINTED BLACK STAR - -% SIXTEEN POINTED ASTERISK - -% TEARDROP-SPOKED ASTERISK - -% OPEN CENTRE TEARDROP-SPOKED ASTERISK - -% HEAVY TEARDROP-SPOKED ASTERISK - -% SIX PETALLED BLACK AND WHITE FLORETTE - -% BLACK FLORETTE - -% WHITE FLORETTE - -% EIGHT PETALLED OUTLINED BLACK FLORETTE - -% CIRCLED OPEN CENTRE EIGHT POINTED STAR - -% HEAVY TEARDROP-SPOKED PINWHEEL ASTERISK - -% SNOWFLAKE - -% TIGHT TRIFOLIATE SNOWFLAKE - -% HEAVY CHEVRON SNOWFLAKE - -% SPARKLE - -% HEAVY SPARKLE - -% BALLOON-SPOKED ASTERISK - -% EIGHT TEARDROP-SPOKED PROPELLER ASTERISK - -% HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK - -% LATIN SMALL LIGATURE FF - "" -% LATIN SMALL LIGATURE FI - ;"" -% LATIN SMALL LIGATURE FL - ;"" -% LATIN SMALL LIGATURE FFI - "" -% LATIN SMALL LIGATURE FFL - "" -% LATIN SMALL LIGATURE LONG S T - "";"" -% LATIN SMALL LIGATURE ST - "" -% ZERO WIDTH NO-BREAK SPACE - "" -% REPLACEMENT CHARACTER - diff --git a/utils/tt2code b/utils/tt2code deleted file mode 100755 index 170954da1..000000000 --- a/utils/tt2code +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/perl -W - -print < - */ - -#include "utils/utils.h" - -void unicode_transliterate(unsigned int c, char **r) -{ - char *s = *r; - switch (c) { - -END - -LINE: while (<>) { - chomp; - next if m/^%/; - next if m/^ *$/; - - m/^ /g or die "invalid line '$_'"; - $z = $1; - next if (hex($z) < 256); - - SUBST: while (m/\G"?(()*)"?;?/g) { - next if $& eq ''; - $m = $1; - if ($m eq '') { - print "case 0x$z: break;\n"; - next; - } - chop $m; - @s = split /> Date: Sat, 12 Jan 2013 14:06:48 +0000 Subject: Fix fast scroll up --- amiga/gui.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 43412704a..a33724f9b 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3630,24 +3630,22 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin, if(width <= 0) return; if(height <= 0) return; -// printf("%ld %ld %ld %ld\n",left, top, width, height); - ami_set_pointer(gwin, GUI_POINTER_WAIT, false); for(y = top; y < (top + height); y += tile_y_scale) { clip.y0 = 0; clip.y1 = nsoption_int(redraw_tile_size_y); + if(clip.y1 > height) clip.y1 = height; if((((y - sy) * gwin->bw->scale) + clip.y1) > bbox->Height) clip.y1 = bbox->Height - ((y - sy) * gwin->bw->scale); for(x = left; x < (left + width); x += tile_x_scale) { clip.x0 = 0; clip.x1 = nsoption_int(redraw_tile_size_x); + if(clip.x1 > width) clip.x1 = width; if((((x - sx) * gwin->bw->scale) + clip.x1) > bbox->Width) clip.x1 = bbox->Width - ((x - sx) * gwin->bw->scale); -//printf("%ld %ld -> %ld %ld\n",clip.x0 - (int)(x), clip.y0 - (int)(y), clip.x1, clip.y1); - if(browser_window_redraw(gwin->bw, clip.x0 - (int)x, clip.y0 - (int)y, -- cgit v1.2.3 From 5124b8a02a2adb72a7352f14e06dc2a773afbc1f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 12 Jan 2013 20:46:01 +0000 Subject: Add textarea_setup struct to textarea_create API. --- desktop/textarea.c | 43 +++++++++++++++++++++++++++++++++---------- desktop/textarea.h | 23 +++++++++++++++++++++-- desktop/tree.c | 20 ++++++++++++++++++-- 3 files changed, 72 insertions(+), 14 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 16c2f4616..3ab8c5af5 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -75,6 +75,17 @@ struct textarea { int vis_width; /**< Visible width, in pixels */ int vis_height; /**< Visible height, in pixels */ + int pad_top; + int pad_right; + int pad_bottom; + int pad_left; + + int border_width; + colour border_col; + + plot_font_style_t fstyle; /**< Text style */ + plot_font_style_t sel_fstyle; /**< Text style */ + char *text; /**< UTF-8 text */ unsigned int text_alloc; /**< Size of allocated text */ unsigned int text_len; /**< Length of text, in bytes */ @@ -92,8 +103,6 @@ struct textarea { int sel_start; /**< Character index of sel start(inclusive) */ int sel_end; /**< Character index of sel end(exclusive) */ - plot_font_style_t fstyle; /**< Text style */ - int line_count; /**< Count of lines */ #define LINE_CHUNK_SIZE 16 struct line_info *lines; /**< Line info array */ @@ -608,8 +617,7 @@ static bool textarea_replace_text(struct textarea *ta, unsigned int start, /* exported interface, documented in textarea.h */ -struct textarea *textarea_create(int width, int height, - textarea_flags flags, const plot_font_style_t *style, +struct textarea *textarea_create(const textarea_setup *setup, textarea_redraw_request_callback redraw_request, void *data) { struct textarea *ret; @@ -627,14 +635,30 @@ struct textarea *textarea_create(int width, int height, ret->redraw_request = redraw_request; ret->data = data; - ret->vis_width = width; - ret->vis_height = height; + + ret->flags = setup->flags; + ret->vis_width = setup->width; + ret->vis_height = setup->height; + + ret->pad_top = setup->pad_top; + ret->pad_right = setup->pad_right; + ret->pad_bottom = setup->pad_bottom; + ret->pad_left = setup->pad_left; + + ret->border_width = setup->border_width; + ret->border_col = setup->border_col; + + ret->fstyle = setup->text; + + ret->sel_fstyle = setup->text; + ret->sel_fstyle.foreground = setup->selected_text; + ret->sel_fstyle.background = setup->selected_bg; + ret->scroll_x = 0; ret->scroll_y = 0; ret->drag_start_char = 0; - ret->flags = flags; ret->text = malloc(64); if (ret->text == NULL) { LOG(("malloc failed")); @@ -646,11 +670,10 @@ struct textarea *textarea_create(int width, int height, ret->text_len = 1; ret->text_utf8_len = 0; - ret->fstyle = *style; - ret->line_height = FIXTOINT(FDIV((FMUL(FLTTOFIX(1.2), FMUL(nscss_screen_dpi, - INTTOFIX((style->size / FONT_SIZE_SCALE))))), F_72)); + INTTOFIX((setup->text.size / + FONT_SIZE_SCALE))))), F_72)); ret->caret_pos.line = ret->caret_pos.char_off = 0; ret->caret_x = MARGIN_LEFT; diff --git a/desktop/textarea.h b/desktop/textarea.h index e4fa2c7aa..a798e7c9f 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -36,6 +36,26 @@ typedef enum textarea_flags { TEXTAREA_READONLY = (1 << 2) } textarea_flags; +typedef struct textarea_setup { + textarea_flags flags; + + int width; + int height; + + int pad_top; + int pad_right; + int pad_bottom; + int pad_left; + + int border_width; + colour border_col; + + colour selected_text; + colour selected_bg; + plot_font_style_t text; + +} textarea_setup; + struct textarea; @@ -54,8 +74,7 @@ typedef void(*textarea_redraw_request_callback)(void *data, int x, int y, * \param data user specified data which will be passed to redraw callbacks * \return Opaque handle for textarea or 0 on error */ -struct textarea *textarea_create(int width, int height, - textarea_flags flags, const plot_font_style_t *style, +struct textarea *textarea_create(const textarea_setup *setup, textarea_redraw_request_callback redraw_request, void *data); /** diff --git a/desktop/tree.c b/desktop/tree.c index 250bdd861..df2e9263f 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -2935,6 +2935,7 @@ void tree_start_edit(struct tree *tree, struct node_element *element) { struct node *parent; int width, height; + textarea_setup ta_setup; assert(tree != NULL); assert(element != NULL); @@ -2959,8 +2960,23 @@ void tree_start_edit(struct tree *tree, struct node_element *element) if (element->type == NODE_ELEMENT_TEXT_PLUS_ICON) width -= NODE_INSTEP; - tree->textarea = textarea_create(width, height, TEXTAREA_DEFAULT, - &plot_fstyle, tree_textarea_redraw_request, tree); + ta_setup.flags = TEXTAREA_DEFAULT; + ta_setup.width = width; + ta_setup.height = height; + ta_setup.pad_top = 0; + ta_setup.pad_right = 4; + ta_setup.pad_bottom = 0; + ta_setup.pad_left = 4; + ta_setup.border_width = 1; + ta_setup.border_col = 0x000000; + ta_setup.selected_text = 0xffffff; + ta_setup.selected_bg = 0x000000; + ta_setup.text = plot_fstyle; + ta_setup.text.foreground = 0x000000; + ta_setup.text.background = 0xffffff; + + tree->textarea = textarea_create(&ta_setup, + tree_textarea_redraw_request, tree); if (tree->textarea == NULL) { tree_stop_edit(tree, false); return; -- cgit v1.2.3 From a6b08c674f3d2fdd91fa6419076e756b07c6630c Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sat, 12 Jan 2013 20:57:01 +0000 Subject: Fix handling of junk input --- utils/nsurl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/nsurl.c b/utils/nsurl.c index 18577b65d..23e177e05 100644 --- a/utils/nsurl.c +++ b/utils/nsurl.c @@ -720,6 +720,9 @@ static nserror nsurl__create_from_section(const char * const url_s, break; } + if (end < start) + end = start; + length = end - start; /* Stage 1: Normalise the required section */ -- cgit v1.2.3 From c7a37392e49deb5007dc3679e0aa7e65b4ff0c8b Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 12 Jan 2013 20:59:32 +0000 Subject: Add background colour to textarea_redraw API. Add source comments. --- desktop/textarea.c | 2 +- desktop/textarea.h | 46 +++++++++++++++++++++------------------------- desktop/tree.c | 5 ++++- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 3ab8c5af5..9b14773cf 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -874,7 +874,7 @@ int textarea_get_caret(struct textarea *ta) /* exported interface, documented in textarea.h */ -void textarea_redraw(struct textarea *ta, int x, int y, +void textarea_redraw(struct textarea *ta, int x, int y, colour bg, const struct rect *clip, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; diff --git a/desktop/textarea.h b/desktop/textarea.h index a798e7c9f..641d39c73 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -37,22 +37,22 @@ typedef enum textarea_flags { } textarea_flags; typedef struct textarea_setup { - textarea_flags flags; + textarea_flags flags; /**< Setup flags */ - int width; - int height; + int width; /**< Textarea width */ + int height; /**< Textarea height */ - int pad_top; - int pad_right; - int pad_bottom; - int pad_left; + int pad_top; /**< Textarea top padding */ + int pad_right; /**< Textarea right padding */ + int pad_bottom; /**< Textarea bottom padding */ + int pad_left; /**< Textarea left padding */ - int border_width; - colour border_col; + int border_width; /**< Textarea border width */ + colour border_col; /**< Textarea border colour */ - colour selected_text; - colour selected_bg; - plot_font_style_t text; + colour selected_text; /**< Textarea selected text colour */ + colour selected_bg; /**< Textarea selection background colour */ + plot_font_style_t text; /**< Font and textarea background colour */ } textarea_setup; @@ -65,13 +65,9 @@ typedef void(*textarea_redraw_request_callback)(void *data, int x, int y, /** * Create a text area * - * \param width width of the text area - * \param height width of the text area - * \param flags text area flags - * \param style font style - * \param redraw_start_callback will be called when textarea wants to redraw - * \param redraw_end_callback will be called when textarea finisjes redrawing - * \param data user specified data which will be passed to redraw callbacks + * \param setup textarea settings and style + * \param redraw_callback will be called when textarea wants to redraw + * \param data user specified data which will be passed to callbacks * \return Opaque handle for textarea or 0 on error */ struct textarea *textarea_create(const textarea_setup *setup, @@ -125,14 +121,14 @@ int textarea_get_caret(struct textarea *ta); /** * Handle redraw requests for text areas * - * \param redraw Redraw request block - * \param x0 left X coordinate of redraw area - * \param y0 top Y coordinate of redraw area - * \param x1 right X coordinate of redraw area - * \param y1 bottom Y coordinate of redraw area + * \param ta textarea to render + * \param x x coordinate of textarea top + * \param y y coordinate of textarea left + * \param bg background colour under textarea + * \param clip clip rectangle * \param ctx current redraw context */ -void textarea_redraw(struct textarea *ta, int x, int y, +void textarea_redraw(struct textarea *ta, int x, int y, colour bg, const struct rect *clip, const struct redraw_context *ctx); /** diff --git a/desktop/tree.c b/desktop/tree.c index df2e9263f..a48b615a0 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -2078,7 +2078,10 @@ void tree_draw(struct tree *tree, int x, int y, y = y + tree->editing->box.y; if (tree->editing->type == NODE_ELEMENT_TEXT_PLUS_ICON) x += NODE_INSTEP; - textarea_redraw(tree->textarea, x, y, &clip, &new_ctx); + textarea_redraw(tree->textarea, x, y, + plot_style_fill_tree_background. + fill_colour, + &clip, &new_ctx); } } -- cgit v1.2.3 From 740559ab52c0f7cf4123eddd4a1d96196843a8cb Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 13 Jan 2013 14:51:26 +0000 Subject: Rewrite redraw to handle selection properly. (Now text can change colour inside selection, rather than just rendering a rectangle under the normal line of text. This removes colour restrictions, allowing e.g. inversion for selected text.) --- desktop/textarea.c | 197 ++++++++++++++++++++++++++++------------------------- 1 file changed, 104 insertions(+), 93 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 9b14773cf..606618c6e 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -38,16 +38,9 @@ #define MARGIN_RIGHT 4 #define CARET_COLOR 0x0000FF /* background color for readonly textarea */ -#define READONLY_BG 0xD9D9D9 -#define BACKGROUND_COL 0xFFFFFF #define BORDER_COLOR 0x000000 #define SELECTION_COL 0xFFDDDD -static plot_style_t pstyle_fill_selection = { - .fill_type = PLOT_OP_TYPE_SOLID, - .fill_colour = SELECTION_COL, -}; - static plot_style_t pstyle_stroke_border = { .stroke_type = PLOT_OP_TYPE_SOLID, .stroke_colour = BORDER_COLOR, @@ -878,15 +871,21 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, const struct rect *clip, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; - int line0, line1, line; - int chars, offset, text_y_offset, text_y_offset_baseline; - unsigned int c_pos, c_len, b_start, b_end, line_len; + int line0, line1, line, left, right; + int chars, text_y_offset, text_y_offset_baseline; + unsigned int c_pos, c_len, c_len_part, b_start, b_end, line_len; + unsigned int sel_start, sel_end; char *line_text; - struct rect r; - plot_style_t plot_style_fill_bg = { - .fill_type = PLOT_OP_TYPE_SOLID, - .fill_colour = BACKGROUND_COL, - }; + struct rect r, s; + bool selected = false; + plot_font_style_t *fstyle; + plot_style_t plot_style_fill_bg = { + .stroke_type = PLOT_OP_TYPE_NONE, + .stroke_width = 0, + .stroke_colour = NS_TRANSPARENT, + .fill_type = PLOT_OP_TYPE_SOLID, + .fill_colour = ta->fstyle.background + }; r = *clip; @@ -899,9 +898,6 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, /* Nothing to redraw */ return; - if (ta->flags & TEXTAREA_READONLY) - plot_style_fill_bg.fill_colour = READONLY_BG; - line0 = (r.y0 - y + ta->scroll_y) / ta->line_height - 1; line1 = (r.y1 - y + ta->scroll_y) / ta->line_height + 1; @@ -928,14 +924,13 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, plot->clip(&r); plot->rectangle(r.x0, r.y0, r.x1, r.y1, &plot_style_fill_bg); plot->rectangle(x, y, - x + ta->vis_width - 1, y + ta->vis_height - 1, - &pstyle_stroke_border); + x + ta->vis_width - 1, y + ta->vis_height - 1, + &pstyle_stroke_border); if (r.x0 < x + MARGIN_LEFT) r.x0 = x + MARGIN_LEFT; if (r.x1 > x + ta->vis_width - MARGIN_RIGHT) r.x1 = x + ta->vis_width - MARGIN_RIGHT; - plot->clip(&r); if (line0 > 0) c_pos = utf8_bounded_length(ta->text, @@ -953,97 +948,113 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, text_y_offset_baseline = (ta->vis_height * 3 + 2) / 4; } + plot_style_fill_bg.fill_colour = ta->sel_fstyle.background; + for (line = line0; (line <= line1) && (y + line * ta->line_height <= r.y1 + ta->scroll_y); line++) { if (ta->lines[line].b_length == 0) continue; + plot->clip(&r); + c_len = utf8_bounded_length( &(ta->text[ta->lines[line].b_start]), ta->lines[line].b_length); - /* if there is a newline between the lines count it too */ - if (line < ta->line_count - 1 && ta->lines[line + 1].b_start != - ta->lines[line].b_start + - ta->lines[line].b_length) - c_len++; - - /* check if a part of the line is selected, won't happen if no - selection (ta->sel_end = -1) */ - if (ta->sel_end != -1 && - c_pos < (unsigned)ta->sel_end && - c_pos + c_len > (unsigned)ta->sel_start) { + b_end = 0; + right = x + MARGIN_LEFT; + + do { + sel_start = ta->sel_start; + sel_end = ta->sel_end; + /* get length of part of line */ + if (ta->sel_end == -1 || ta->sel_end == ta->sel_start || + sel_end <= c_pos || + sel_start > c_pos + c_len) { + /* rest of line unselected */ + selected = false; + c_len_part = c_len; + fstyle = &ta->fstyle; + + } else if (sel_start <= c_pos && + sel_end > c_pos + c_len) { + /* rest of line selected */ + selected = true; + c_len_part = c_len; + fstyle = &ta->sel_fstyle; + + } else if (sel_start > c_pos) { + /* next part of line unselected */ + selected = false; + c_len_part = sel_start - c_pos; + fstyle = &ta->fstyle; + + } else if (sel_end > c_pos) { + /* next part of line selected */ + selected = true; + c_len_part = sel_end - c_pos; + fstyle = &ta->sel_fstyle; - /* offset from the beginning of the line */ - offset = ta->sel_start - c_pos; - chars = ta->sel_end - c_pos - - (offset > 0 ? offset:0); + } else { + assert(0); + } line_text = &(ta->text[ta->lines[line].b_start]); line_len = ta->lines[line].b_length; - if (offset > 0) { - - /* find byte start of the selected part */ - for (b_start = 0; offset > 0; offset--) - b_start = utf8_next(line_text, - line_len, - b_start); - nsfont.font_width(&ta->fstyle, line_text, - b_start, &r.x0); - r.x0 += x + MARGIN_LEFT; - } - else { - r.x0 = x + MARGIN_LEFT; - b_start = 0; - } - - - if (chars >= 0) { - - /* find byte end of the selected part */ - for (b_end = b_start; chars > 0 && - b_end < line_len; - chars--) { - b_end = utf8_next(line_text, line_len, - b_end); - } + /* find b_start and b_end for this part of the line */ + b_start = b_end; + + chars = c_len_part; + for (b_end = b_start; chars > 0; chars--) + b_end = utf8_next(line_text, line_len, b_end); + + /* find clip left/right for this part of line */ + left = right; + nsfont.font_width(&ta->fstyle, line_text, + b_end, &right); + right += x + MARGIN_LEFT; + + /* set clip */ + s = r; + if (s.x0 < left) + s.x0 = left; + if (s.x1 > right) + s.x1 = right; + plot->clip(&s); + + if (selected) { + /* draw selection fill */ + plot->rectangle(s.x0 - ta->scroll_x, + y + line * ta->line_height + 1 - + ta->scroll_y + text_y_offset, + s.x1 - ta->scroll_x, + y + (line + 1) * ta->line_height + 1 - + ta->scroll_y + text_y_offset, + &plot_style_fill_bg); } - else - b_end = ta->lines[line].b_length; - - b_end -= b_start; - nsfont.font_width(&ta->fstyle, - &(ta->text[ta->lines[line].b_start + - b_start]), - b_end, &r.x1); - r.x1 += r.x0; - plot->rectangle(r.x0 - ta->scroll_x, y + - line * ta->line_height + - 1 - ta->scroll_y + text_y_offset, - r.x1 - ta->scroll_x, - y + (line + 1) * ta->line_height - - 1 - ta->scroll_y + text_y_offset, - &pstyle_fill_selection); - - } - c_pos += c_len; + /* draw text */ + plot->text(x + MARGIN_LEFT - ta->scroll_x, + y + line * ta->line_height + + text_y_offset_baseline - ta->scroll_y, + ta->text + ta->lines[line].b_start, + ta->lines[line].b_length, fstyle); - r.y0 = y + line * ta->line_height + text_y_offset_baseline; + c_pos += c_len_part; + c_len -= c_len_part; - ta->fstyle.background = - (ta->flags & TEXTAREA_READONLY) ? - READONLY_BG : BACKGROUND_COL, + } while (c_pos < c_pos + c_len); - plot->text(x + MARGIN_LEFT - ta->scroll_x, - r.y0 - ta->scroll_y, - ta->text + ta->lines[line].b_start, - ta->lines[line].b_length, - &ta->fstyle); + /* if there is a newline between the lines, skip it */ + if (line < ta->line_count - 1 && ta->lines[line + 1].b_start != + ta->lines[line].b_start + + ta->lines[line].b_length) + c_pos++; } + plot->clip(&r); x -= ta->scroll_x; y -= ta->scroll_y; @@ -1099,10 +1110,10 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) case KEY_SELECT_ALL: caret = ta->text_utf8_len; - ta->sel_start = 0; + ta->sel_start = 0; ta->sel_end = ta->text_utf8_len; - redraw = true; - break; + redraw = true; + break; case KEY_COPY_SELECTION: if (ta->sel_start != -1) { if (!textarea_replace_text(ta, -- cgit v1.2.3 From 716b50062b7d700d0048809c0433468a3a892f93 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 13 Jan 2013 15:16:13 +0000 Subject: Update for new textarea API. --- atari/toolbar.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/atari/toolbar.c b/atari/toolbar.c index 3594d24c0..82dc047fa 100755 --- a/atari/toolbar.c +++ b/atari/toolbar.c @@ -707,7 +707,7 @@ void tb_url_redraw( struct gui_window * gw ) .x1 = todo[0]+todo[2], .y1 = todo[1]+todo[3] }; - textarea_redraw( t->url.textarea, 0, 0, &clip, &ctx ); + textarea_redraw( t->url.textarea, 0, 0, 0xffffff, &clip, &ctx ); } if (wind_get(gw->root->handle->handle, WF_NEXTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])==0) { @@ -770,11 +770,22 @@ CMP_TOOLBAR tb_create( struct gui_window * gw ) int ta_height = toolbar_styles[t->style].height; ta_height -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM); - t->url.textarea = textarea_create( 300, - ta_height, - 0, - &font_style_url, tb_txt_request_redraw, - t ); + textarea_setup ta_setup; + ta_setup.flags = TEXTAREA_DEFAULT; + ta_setup.width = 300; + ta_setup.height = ta_height; + ta_setup.pad_top = 0; + ta_setup.pad_right = 4; + ta_setup.pad_bottom = 0; + ta_setup.pad_left = 4; + ta_setup.border_width = 1; + ta_setup.border_col = 0x000000; + ta_setup.selected_text = 0xffffff; + ta_setup.selected_bg = 0x000000; + ta_setup.text = font_style_url; + ta_setup.text.foreground = 0x000000; + ta_setup.text.background = 0xffffff; + t->url.textarea = textarea_create( &ta_setup, tb_txt_request_redraw, t ); if( t->url.textarea != NULL ){ textarea_set_text(t->url.textarea, "http://"); } -- cgit v1.2.3 From 8e66adaade55a6ca82a6e8a97e52312adafe38ce Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sun, 13 Jan 2013 17:12:45 +0000 Subject: Avoid calling bitmap_modified with NULL. --- image/png.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/image/png.c b/image/png.c index 23c755825..2a8334693 100644 --- a/image/png.c +++ b/image/png.c @@ -502,7 +502,8 @@ png_cache_convert_error: free((png_bytep *) row_pointers); - bitmap_modified((struct bitmap *)bitmap); + if (bitmap != NULL) + bitmap_modified((struct bitmap *)bitmap); return (struct bitmap *)bitmap; } -- cgit v1.2.3 From 6e09ff691bbba9aa5bd68e0f1d9f66a709149599 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sun, 13 Jan 2013 17:54:11 +0000 Subject: Consult internal mimemap before consulting MimeMap module. --- riscos/filetype.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/riscos/filetype.c b/riscos/filetype.c index ec15b3655..529f867ab 100644 --- a/riscos/filetype.c +++ b/riscos/filetype.c @@ -305,9 +305,21 @@ int ro_content_native_type(hlcache_handle *c) */ int ro_content_filetype_from_mime_type(lwc_string *mime_type) { - int file_type; + int file_type, index; os_error *error; + /* Search internal type map */ + for (index = TYPE_MAP_COUNT; index > 0; index--) { + const struct type_entry *e = &type_map[index - 1]; + + if (strlen(e->mime_type) == lwc_string_length(mime_type) && + strncasecmp(e->mime_type, + lwc_string_data(mime_type), + lwc_string_length(mime_type)) == 0) + return e->file_type; + } + + /* Ask MimeMap module */ error = xmimemaptranslate_mime_type_to_filetype( lwc_string_data(mime_type), (bits *) &file_type); if (error) -- cgit v1.2.3 From 4e7edf00e217bc05ab6c0b45bcf9e9d843f99f32 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sun, 13 Jan 2013 18:18:49 +0000 Subject: Fix 1912552: move FontRemove into ro_gui_cleanup() --- riscos/gui.c | 2 ++ riscos/scripts/Run | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/riscos/gui.c b/riscos/gui.c index 8eac42de7..de5dc4af4 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -944,6 +944,8 @@ void ro_gui_cleanup(void) { ro_gui_buffer_close(); xhourglass_off(); + /* Uninstall NetSurf-specific fonts */ + xos_cli("FontRemove NetSurf:Resources.Fonts."); } diff --git a/riscos/scripts/Run b/riscos/scripts/Run index d3b9988e8..f1300f607 100644 --- a/riscos/scripts/Run +++ b/riscos/scripts/Run @@ -114,6 +114,3 @@ FontInstall NetSurf:Resources.Fonts. WIMPSLOT Run .!RunImage %*0 2>.WWW.NetSurf.Log - -| Uninstall NetSurf-specific fonts -FontRemove NetSurf:Resources.Fonts. -- cgit v1.2.3 From a2e67922d5702c9691a688abf622cf8afdc6fd9c Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sun, 13 Jan 2013 18:45:05 +0000 Subject: Fix 2576557: prepend '!' to target leafname if preparing a full save. --- riscos/save.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/riscos/save.c b/riscos/save.c index f61fd012b..12af6ab22 100644 --- a/riscos/save.c +++ b/riscos/save.c @@ -1239,6 +1239,11 @@ void ro_gui_save_set_state(hlcache_handle *h, gui_save_type save_type, } /* filename is utf8 */ + if (save_type == GUI_SAVE_COMPLETE && leaf_len > 0) { + leaf_buf[0] = '!'; + leaf_buf++; + leaf_len--; + } strncpy(leaf_buf, name, leaf_len); leaf_buf[leaf_len - 1] = 0; -- cgit v1.2.3 From e7ef916b53510f643736e6b21cd27e896886f5bc Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 13 Jan 2013 19:06:51 +0000 Subject: Prevent deadlock during simple refresh damaged area redraw --- amiga/gui.c | 33 ++++++++++++++++++--------------- amiga/gui.h | 2 -- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index a33724f9b..8494578b1 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3591,7 +3591,7 @@ void gui_window_set_title(struct gui_window *g, const char *title) } } -void ami_do_redraw_tiled(struct gui_window_2 *gwin, +void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy, int left, int top, int width, int height, int sx, int sy, struct IBox *bbox, struct redraw_context *ctx) { @@ -3630,7 +3630,7 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin, if(width <= 0) return; if(height <= 0) return; - ami_set_pointer(gwin, GUI_POINTER_WAIT, false); + if(busy) ami_set_pointer(gwin, GUI_POINTER_WAIT, false); for(y = top; y < (top + height); y += tile_y_scale) { clip.y0 = 0; @@ -3668,7 +3668,7 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin, } } - ami_reset_pointer(gwin); + if(busy) ami_reset_pointer(gwin); } @@ -3683,7 +3683,7 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin, * \param y1 bottom-right co-ordinate (in document co-ordinates) */ -void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw, +void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw, bool busy, int x0, int y0, int x1, int y1) { ULONG xoffset,yoffset,width=800,height=600; @@ -3714,7 +3714,7 @@ void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw, GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox); - ami_do_redraw_tiled(g->shared, x0, y0, x1 - x0, y1 - y0, sx, sy, bbox, &ctx); + ami_do_redraw_tiled(g->shared, busy, x0, y0, x1 - x0, y1 - y0, sx, sy, bbox, &ctx); return; } @@ -3735,7 +3735,7 @@ void gui_window_update_box(struct gui_window *g, const struct rect *rect) { if(!g) return; - ami_do_redraw_limits(g, g->shared->bw, + ami_do_redraw_limits(g, g->shared->bw, true, rect->x0, rect->y0, rect->x1, rect->y1); } @@ -3794,14 +3794,14 @@ void ami_do_redraw(struct gui_window_2 *gwin) if(vcurrent>oldv) /* Going down */ { - ami_do_redraw_limits(gwin->bw->window, gwin->bw, + ami_do_redraw_limits(gwin->bw->window, gwin->bw, true, hcurrent, (height / gwin->bw->scale) + oldv - 1, hcurrent + (width / gwin->bw->scale), vcurrent + (height / gwin->bw->scale) + 1); } else if(vcurrentbw->window, gwin->bw, + ami_do_redraw_limits(gwin->bw->window, gwin->bw, true, hcurrent, vcurrent, hcurrent + (width / gwin->bw->scale), oldv); @@ -3809,14 +3809,14 @@ void ami_do_redraw(struct gui_window_2 *gwin) if(hcurrent>oldh) /* Going right */ { - ami_do_redraw_limits(gwin->bw->window, gwin->bw, + ami_do_redraw_limits(gwin->bw->window, gwin->bw, true, (width / gwin->bw->scale) + oldh , vcurrent, hcurrent + (width / gwin->bw->scale), vcurrent + (height / gwin->bw->scale)); } else if(hcurrentbw->window, gwin->bw, + ami_do_redraw_limits(gwin->bw->window, gwin->bw, true, hcurrent, vcurrent, oldh, vcurrent + (height / gwin->bw->scale)); } @@ -3834,7 +3834,7 @@ void ami_do_redraw(struct gui_window_2 *gwin) if(nsoption_bool(direct_render) == false) { - ami_do_redraw_tiled(gwin, hcurrent, vcurrent, width, height, hcurrent, vcurrent, bbox, &ctx); + ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent, width, height, hcurrent, vcurrent, bbox, &ctx); } else { @@ -3880,7 +3880,8 @@ void ami_refresh_window(struct gui_window_2 *gwin) sy = gwin->bw->window->scrolly; GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER], (ULONG *)&bbox); - + ami_set_pointer(gwin, GUI_POINTER_WAIT, false); + BeginRefresh(gwin->win); x0 = ((gwin->win->RPort->Layer->DamageList->bounds.MinX - bbox->Left) / @@ -3894,7 +3895,7 @@ void ami_refresh_window(struct gui_window_2 *gwin) regrect = gwin->win->RPort->Layer->DamageList->RegionRectangle; - ami_do_redraw_limits(gwin->bw->window, gwin->bw, x0, y0, x1, y1); + ami_do_redraw_limits(gwin->bw->window, gwin->bw, false, x0, y0, x1, y1); while(regrect) { @@ -3909,10 +3910,12 @@ void ami_refresh_window(struct gui_window_2 *gwin) regrect = regrect->Next; - ami_do_redraw_limits(gwin->bw->window, gwin->bw, x0, y0, x1, y1); + ami_do_redraw_limits(gwin->bw->window, gwin->bw, false, x0, y0, x1, y1); } EndRefresh(gwin->win, TRUE); + + ami_reset_pointer(gwin); } void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs) @@ -4330,7 +4333,7 @@ void gui_window_remove_caret(struct gui_window *g) if((nsoption_bool(kiosk_mode) == false)) OffMenu(g->shared->win, AMI_MENU_PASTE); - ami_do_redraw_limits(g, g->shared->bw, g->c_x, g->c_y, + ami_do_redraw_limits(g, g->shared->bw, true, g->c_x, g->c_y, g->c_x + g->c_w + 1, g->c_y + g->c_h + 1); g->c_h = 0; diff --git a/amiga/gui.h b/amiga/gui.h index ff467977a..60ea7d900 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -147,8 +147,6 @@ void ami_get_msg(void); void ami_close_all_tabs(struct gui_window_2 *gwin); void ami_quit_netsurf(void); void ami_do_redraw(struct gui_window_2 *g); -void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw, - int x0, int y0, int x1, int y1); STRPTR ami_locale_langs(void); int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie); bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y); -- cgit v1.2.3 From 8625933812a3d33261bf67cb82aad7f8075599db Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 13 Jan 2013 19:11:48 +0000 Subject: Expand the damaged area rectangle by one pixel each side to stop missing lines --- amiga/gui.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 8494578b1..99660739c 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3885,13 +3885,13 @@ void ami_refresh_window(struct gui_window_2 *gwin) BeginRefresh(gwin->win); x0 = ((gwin->win->RPort->Layer->DamageList->bounds.MinX - bbox->Left) / - browser_window_get_scale(gwin->bw)) + sx; + browser_window_get_scale(gwin->bw)) + sx - 1; x1 = ((gwin->win->RPort->Layer->DamageList->bounds.MaxX - bbox->Left) / - browser_window_get_scale(gwin->bw)) + sx; + browser_window_get_scale(gwin->bw)) + sx + 2; y0 = ((gwin->win->RPort->Layer->DamageList->bounds.MinY - bbox->Top) / - browser_window_get_scale(gwin->bw)) + sy; + browser_window_get_scale(gwin->bw)) + sy - 1; y1 = ((gwin->win->RPort->Layer->DamageList->bounds.MaxY - bbox->Top) / - browser_window_get_scale(gwin->bw)) + sy; + browser_window_get_scale(gwin->bw)) + sy + 2; regrect = gwin->win->RPort->Layer->DamageList->RegionRectangle; @@ -3900,13 +3900,13 @@ void ami_refresh_window(struct gui_window_2 *gwin) while(regrect) { x0 = ((regrect->bounds.MinX - bbox->Left) / - browser_window_get_scale(gwin->bw)) + sx; + browser_window_get_scale(gwin->bw)) + sx - 1; x1 = ((regrect->bounds.MaxX - bbox->Left) / - browser_window_get_scale(gwin->bw)) + sx; + browser_window_get_scale(gwin->bw)) + sx + 2; y0 = ((regrect->bounds.MinY - bbox->Top) / - browser_window_get_scale(gwin->bw)) + sy; + browser_window_get_scale(gwin->bw)) + sy - 1; y1 = ((regrect->bounds.MaxY - bbox->Top) / - browser_window_get_scale(gwin->bw)) + sy; + browser_window_get_scale(gwin->bw)) + sy + 2; regrect = regrect->Next; -- cgit v1.2.3 From 6975360e1c3aeeb8607857c5f9c11158a12b76ea Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 13 Jan 2013 19:19:59 +0000 Subject: Disable compositing if simple refresh is enabled; set it back to "like WB" if simple refresh is disabled. --- amiga/gui_options.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/amiga/gui_options.c b/amiga/gui_options.c index e54ad15a6..d2478d67f 100755 --- a/amiga/gui_options.c +++ b/amiga/gui_options.c @@ -33,10 +33,11 @@ #include "amiga/font.h" #include "amiga/gui.h" #include "amiga/gui_options.h" +#include "amiga/theme.h" +#include "amiga/utf8.h" #include "utils/messages.h" #include "desktop/browser_private.h" #include "desktop/options.h" -#include "amiga/utf8.h" #include "desktop/searchweb.h" #include @@ -1582,10 +1583,12 @@ void ami_gui_opts_use(bool save) } GetAttr(GA_Selected,gow->objects[GID_OPTS_WIN_SIMPLE],(ULONG *)&data); - if (data) { + if ((data == TRUE) && (nsoption_bool(window_simple_refresh) == false)) { nsoption_set_bool(window_simple_refresh, true); - } else { + nsoption_set_int(screen_compositing, 0); + } else if ((data == FALSE) && (nsoption_bool(window_simple_refresh) == true)) { nsoption_set_bool(window_simple_refresh, false); + nsoption_set_int(screen_compositing, -1); } GetAttr(GETFILE_Drawer,gow->objects[GID_OPTS_THEME],(ULONG *)&data); -- cgit v1.2.3 From a6b117fcb43b8afea584ff2e6ec3e808f27f8d9f Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sun, 13 Jan 2013 21:49:06 +0000 Subject: Fix 3556638: can't use SpriteExtend version number to detect alpha sprite support any more. --- !NetSurf/!Boot,feb | 11 +++-------- !NetSurf/ChkSprites,ffb | Bin 0 -> 881 bytes 2 files changed, 3 insertions(+), 8 deletions(-) create mode 100644 !NetSurf/ChkSprites,ffb diff --git a/!NetSurf/!Boot,feb b/!NetSurf/!Boot,feb index b1d9edc3d..1ba2ebde2 100644 --- a/!NetSurf/!Boot,feb +++ b/!NetSurf/!Boot,feb @@ -43,14 +43,9 @@ If (("" = "") OR ("" = "1")) Then Set NetS If (("" = "") OR ("" = "1")) Then Set NetSurf$Description "Web browser" | NetSurf Sprites -| -| The sprite file used is based on the OS and SpriteExtend versions: -| RO <> 5 and SpriteExtend < 1.50 uses !Sprites -| RO <> 5 and SpriteExtend >= 1.50 uses ASprites -| RO = 5 uses 5Sprites -Set NetSurf$Sprites .ASprites -RMEnsure SpriteExtend 1.50 Set NetSurf$Sprites .!Sprites -If (("" >= "500") AND ("" < "600")) Then IconSprites .5Sprites Else IconSprites +Set NetSurf$Sprites "!Sprites" +/.ChkSprites +IconSprites . Unset NetSurf$Sprites | Acorn URI protocol diff --git a/!NetSurf/ChkSprites,ffb b/!NetSurf/ChkSprites,ffb new file mode 100644 index 000000000..52e456ccc Binary files /dev/null and b/!NetSurf/ChkSprites,ffb differ -- cgit v1.2.3 From 2b7bc02961a3fa251f58618b73527968cecda8ef Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 13 Jan 2013 23:01:29 +0000 Subject: Implement most of the styling needed for HTML. Allow caret to be hidden. --- desktop/textarea.c | 107 ++++++++++++++++++++++++++++++----------------------- desktop/textarea.h | 2 +- 2 files changed, 62 insertions(+), 47 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 606618c6e..94d9b96c1 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -34,18 +34,7 @@ #include "utils/utf8.h" #include "utils/utils.h" -#define MARGIN_LEFT 4 -#define MARGIN_RIGHT 4 #define CARET_COLOR 0x0000FF -/* background color for readonly textarea */ -#define BORDER_COLOR 0x000000 -#define SELECTION_COL 0xFFDDDD - -static plot_style_t pstyle_stroke_border = { - .stroke_type = PLOT_OP_TYPE_SOLID, - .stroke_colour = BORDER_COLOR, - .stroke_width = 1, -}; static plot_style_t pstyle_stroke_caret = { .stroke_type = PLOT_OP_TYPE_SOLID, @@ -245,8 +234,8 @@ static bool textarea_scroll_visible(struct textarea *ta) if (ta->caret_pos.char_off == -1) return false; - x0 = MARGIN_LEFT; - x1 = ta->vis_width - MARGIN_RIGHT; + x0 = ta->border_width + ta->pad_left; + x1 = ta->vis_width - (ta->border_width + ta->pad_left); y0 = 0; y1 = ta->vis_height; @@ -267,8 +256,8 @@ static bool textarea_scroll_visible(struct textarea *ta) if (x < x0) { ta->scroll_x -= x0 - x ; scrolled = true; - } else if (x > x1 - 1) { - ta->scroll_x += x - (x1 - 1); + } else if (x > x1) { + ta->scroll_x += x - x1; scrolled = true; } @@ -291,6 +280,10 @@ static bool textarea_reflow(struct textarea *ta, unsigned int line) int x; char *space, *para_end; unsigned int line_count = 0; + int avail_width = ta->vis_width - 2 * ta->border_width - + ta->pad_left - ta->pad_right; + if (avail_width < 0) + avail_width = 0; /** \todo pay attention to line parameter */ /** \todo create horizontal scrollbar if needed */ @@ -327,8 +320,7 @@ static bool textarea_reflow(struct textarea *ta, unsigned int line) /* Wrap current line in paragraph */ nsfont.font_split(&ta->fstyle, text, para_end - text, - ta->vis_width - MARGIN_LEFT - MARGIN_RIGHT, - &b_off, &x); + avail_width, &b_off, &x); if (b_off == 0) { /* Text wasn't split */ @@ -407,8 +399,8 @@ static void textarea_get_xy_offset(struct textarea *ta, int x, int y, return; } - x = x - MARGIN_LEFT + ta->scroll_x; - y = y + ta->scroll_y; + x = x - ta->border_width - ta->pad_left + ta->scroll_x; + y = y - ta->border_width - ta->pad_top + ta->scroll_y; if (x < 0) x = 0; @@ -668,8 +660,8 @@ struct textarea *textarea_create(const textarea_setup *setup, INTTOFIX((setup->text.size / FONT_SIZE_SCALE))))), F_72)); - ret->caret_pos.line = ret->caret_pos.char_off = 0; - ret->caret_x = MARGIN_LEFT; + ret->caret_pos.line = ret->caret_pos.char_off = -1; + ret->caret_x = 0; ret->caret_y = 0; ret->sel_start = -1; ret->sel_end = -1; @@ -759,7 +751,7 @@ bool textarea_set_caret(struct textarea *ta, int caret) if (ta->flags & TEXTAREA_MULTILINE) { /* Multiline textarea */ - text_y_offset = 0; + text_y_offset = ta->border_width + ta->pad_top; } else { /* Single line text area; text is vertically centered */ text_y_offset = (ta->vis_height - ta->line_height + 1) / 2; @@ -813,7 +805,7 @@ bool textarea_set_caret(struct textarea *ta, int caret) b_off - ta->lines[ta->caret_pos.line].b_start, &x); - x += MARGIN_LEFT; + x += ta->border_width + ta->pad_left; ta->caret_x = x; y = ta->line_height * ta->caret_pos.line; ta->caret_y = y; @@ -827,9 +819,9 @@ bool textarea_set_caret(struct textarea *ta, int caret) /* Just caret moved, redraw it */ x -= ta->scroll_x; y -= ta->scroll_y; - x0 = max(x - 1, MARGIN_LEFT); + x0 = max(x - 1, ta->border_width); y0 = max(y + text_y_offset, 0); - x1 = min(x + 1, ta->vis_width - MARGIN_RIGHT); + x1 = min(x + 1, ta->vis_width - ta->border_width); y1 = min(y + ta->line_height + text_y_offset, ta->vis_height); @@ -852,6 +844,9 @@ int textarea_get_caret(struct textarea *ta) { unsigned int c_off = 0, b_off; + /* Ensure caret isn't hidden */ + if (ta->caret_pos.char_off < 0) + textarea_set_caret(ta, 0); /* if the text is a trailing NUL only */ if (ta->text_utf8_len == 0) @@ -884,7 +879,7 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, .stroke_width = 0, .stroke_colour = NS_TRANSPARENT, .fill_type = PLOT_OP_TYPE_SOLID, - .fill_colour = ta->fstyle.background + .fill_colour = ta->border_col }; r = *clip; @@ -922,15 +917,29 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, r.y1 = y + ta->vis_height; plot->clip(&r); - plot->rectangle(r.x0, r.y0, r.x1, r.y1, &plot_style_fill_bg); - plot->rectangle(x, y, - x + ta->vis_width - 1, y + ta->vis_height - 1, - &pstyle_stroke_border); + if (ta->border_col != NS_TRANSPARENT && + ta->border_width > 0) { + /* Plot border */ + plot->rectangle(x, y, x + ta->vis_width, y + ta->vis_height, + &plot_style_fill_bg); + } + if (ta->fstyle.background != NS_TRANSPARENT) { + /* Plot background */ + plot_style_fill_bg.fill_colour = ta->fstyle.background; + plot->rectangle(x + ta->border_width, y + ta->border_width, + x + ta->vis_width - ta->border_width, + y + ta->vis_height - ta->border_width, + &plot_style_fill_bg); + } - if (r.x0 < x + MARGIN_LEFT) - r.x0 = x + MARGIN_LEFT; - if (r.x1 > x + ta->vis_width - MARGIN_RIGHT) - r.x1 = x + ta->vis_width - MARGIN_RIGHT; + if (r.x0 < x + ta->border_width) + r.x0 = x + ta->border_width; + if (r.x1 > x + ta->vis_width - ta->border_width) + r.x1 = x + ta->vis_width - ta->border_width; + if (r.y0 < y + ta->border_width) + r.y0 = y + ta->border_width; + if (r.y1 > y + ta->vis_width - ta->border_width) + r.y1 = y + ta->vis_height - ta->border_width; if (line0 > 0) c_pos = utf8_bounded_length(ta->text, @@ -938,14 +947,17 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, else c_pos = 0; + text_y_offset = text_y_offset_baseline = ta->border_width; if (ta->flags & TEXTAREA_MULTILINE) { /* Multiline textarea */ - text_y_offset = 0; - text_y_offset_baseline = (ta->line_height * 3 + 2) / 4; + text_y_offset += ta->pad_top; + text_y_offset_baseline += (ta->line_height * 3 + 2) / 4 + + ta->pad_top; } else { /* Single line text area; text is vertically centered */ - text_y_offset = (ta->vis_height - ta->line_height + 1) / 2; - text_y_offset_baseline = (ta->vis_height * 3 + 2) / 4; + int vis_height = ta->vis_height - 2 * ta->border_width; + text_y_offset += (vis_height - ta->line_height + 1) / 2; + text_y_offset_baseline += (vis_height * 3 + 2) / 4; } plot_style_fill_bg.fill_colour = ta->sel_fstyle.background; @@ -956,6 +968,7 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, if (ta->lines[line].b_length == 0) continue; + /* reset clip rectangle */ plot->clip(&r); c_len = utf8_bounded_length( @@ -963,7 +976,7 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, ta->lines[line].b_length); b_end = 0; - right = x + MARGIN_LEFT; + right = x + ta->border_width + ta->pad_left; do { sel_start = ta->sel_start; @@ -1014,9 +1027,9 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, left = right; nsfont.font_width(&ta->fstyle, line_text, b_end, &right); - right += x + MARGIN_LEFT; + right += x + ta->border_width + ta->pad_left; - /* set clip */ + /* set clip rectangle for line part */ s = r; if (s.x0 < left) s.x0 = left; @@ -1036,7 +1049,8 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, } /* draw text */ - plot->text(x + MARGIN_LEFT - ta->scroll_x, + plot->text(x + ta->border_width + ta->pad_left - + ta->scroll_x, y + line * ta->line_height + text_y_offset_baseline - ta->scroll_y, ta->text + ta->lines[line].b_start, @@ -1048,9 +1062,10 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, } while (c_pos < c_pos + c_len); /* if there is a newline between the lines, skip it */ - if (line < ta->line_count - 1 && ta->lines[line + 1].b_start != - ta->lines[line].b_start + - ta->lines[line].b_length) + if (line < ta->line_count - 1 && + ta->lines[line + 1].b_start != + ta->lines[line].b_start + + ta->lines[line].b_length) c_pos++; } @@ -1061,7 +1076,7 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, if (ta->sel_end == -1 || ta->sel_start == ta->sel_end) { /* There is no selection; draw caret */ int caret_y = y + ta->caret_y + text_y_offset; - int caret_height = caret_y + ta->line_height - 1; + int caret_height = caret_y + ta->line_height; plot->line(x + ta->caret_x, caret_y, x + ta->caret_x, caret_height, diff --git a/desktop/textarea.h b/desktop/textarea.h index 641d39c73..7624c3187 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -52,7 +52,7 @@ typedef struct textarea_setup { colour selected_text; /**< Textarea selected text colour */ colour selected_bg; /**< Textarea selection background colour */ - plot_font_style_t text; /**< Font and textarea background colour */ + plot_font_style_t text; /**< Textarea background colour and font */ } textarea_setup; -- cgit v1.2.3 From 700aea8b08c565926e35d1816ad8a1db36f1462c Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 14 Jan 2013 11:46:56 +0000 Subject: Fix caret removal redraw to take account of border width. Fix scroll_visible to take account of border width in vertical scroll. --- desktop/textarea.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 94d9b96c1..3241cf9d3 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -237,7 +237,7 @@ static bool textarea_scroll_visible(struct textarea *ta) x0 = ta->border_width + ta->pad_left; x1 = ta->vis_width - (ta->border_width + ta->pad_left); y0 = 0; - y1 = ta->vis_height; + y1 = ta->vis_height - 2 * ta->border_width; x = ta->caret_x - ta->scroll_x; y = ta->caret_y - ta->scroll_y; @@ -754,13 +754,14 @@ bool textarea_set_caret(struct textarea *ta, int caret) text_y_offset = ta->border_width + ta->pad_top; } else { /* Single line text area; text is vertically centered */ - text_y_offset = (ta->vis_height - ta->line_height + 1) / 2; + text_y_offset = ta->border_width; + text_y_offset += (ta->vis_height - ta->line_height + 1) / 2; } /* Delete the old caret */ if (ta->caret_pos.char_off != -1) { x0 = ta->caret_x - ta->scroll_x; - y0 = ta->caret_y - ta->scroll_y; + y0 = ta->caret_y + text_y_offset - ta->scroll_y; width = 2; height = ta->line_height; -- cgit v1.2.3 From 96264ca71ebddece12360c742ce4215011e5b282 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 14 Jan 2013 12:01:23 +0000 Subject: Use right padding. Thanks jmb. --- desktop/textarea.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 3241cf9d3..e782fd6fd 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -235,7 +235,7 @@ static bool textarea_scroll_visible(struct textarea *ta) return false; x0 = ta->border_width + ta->pad_left; - x1 = ta->vis_width - (ta->border_width + ta->pad_left); + x1 = ta->vis_width - (ta->border_width + ta->pad_right); y0 = 0; y1 = ta->vis_height - 2 * ta->border_width; -- cgit v1.2.3 From 4e756f6088bce4cd634702d02ccdae5389392a17 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 14 Jan 2013 13:59:07 +0000 Subject: Remove architecture from UA string. --- Makefile.defaults | 4 ++-- utils/useragent.c | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Makefile.defaults b/Makefile.defaults index 7650b381f..d8f5b9b0c 100644 --- a/Makefile.defaults +++ b/Makefile.defaults @@ -78,9 +78,9 @@ NETSURF_USE_HARU_PDF := NO NETSURF_STRIP_BINARY := NO # Template used for constructing the User Agent: string. The first two -# replacements are major/minor version, second two are OS and architecture. +# replacements are major/minor version, next is OS. # Please don't be tempted to mention Mozilla here! Let's let that lie die. -NETSURF_UA_FORMAT_STRING := "NetSurf/%d.%d (%s; %s)" +NETSURF_UA_FORMAT_STRING := "NetSurf/%d.%d (%s)" # Default home page, if one is not defined by the user. Note that this # option does not apply to the RISC OS version, as it has its own local diff --git a/utils/useragent.c b/utils/useragent.c index 5b8c9e10f..91f43636c 100644 --- a/utils/useragent.c +++ b/utils/useragent.c @@ -29,7 +29,7 @@ static const char *core_user_agent_string = NULL; #ifndef NETSURF_UA_FORMAT_STRING -#define NETSURF_UA_FORMAT_STRING "NetSurf/%d.%d (%s; %s)" +#define NETSURF_UA_FORMAT_STRING "NetSurf/%d.%d (%s)" #endif /** @@ -41,20 +41,17 @@ user_agent_build_string(void) { struct utsname un; const char *sysname = "Unknown"; - const char *machine = "Unknown"; char *ua_string; int len; if (uname(&un) >= 0) { sysname = un.sysname; - machine = un.machine; } len = snprintf(NULL, 0, NETSURF_UA_FORMAT_STRING, netsurf_version_major, netsurf_version_minor, - sysname, - machine); + sysname); ua_string = malloc(len + 1); if (!ua_string) { /** \todo this needs handling better */ @@ -64,8 +61,7 @@ user_agent_build_string(void) NETSURF_UA_FORMAT_STRING, netsurf_version_major, netsurf_version_minor, - sysname, - machine); + sysname); core_user_agent_string = ua_string; -- cgit v1.2.3 From 78e956607f2ca6c592c5f76865441cab57da7860 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Tue, 15 Jan 2013 19:23:20 +0000 Subject: Don't busy the pointer when removing the caret - it's pointless and flickery --- amiga/gui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amiga/gui.c b/amiga/gui.c index 99660739c..08408b0a8 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -4333,7 +4333,7 @@ void gui_window_remove_caret(struct gui_window *g) if((nsoption_bool(kiosk_mode) == false)) OffMenu(g->shared->win, AMI_MENU_PASTE); - ami_do_redraw_limits(g, g->shared->bw, true, g->c_x, g->c_y, + ami_do_redraw_limits(g, g->shared->bw, false, g->c_x, g->c_y, g->c_x + g->c_w + 1, g->c_y + g->c_h + 1); g->c_h = 0; -- cgit v1.2.3 From 348e9789a42ce5479dcd38057d9d9d37fedaff6f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 15 Jan 2013 19:40:32 +0000 Subject: Add scrollbars to textarea, and improve scrolling to try to keep caret in centre. Currently the scrollbars are mostly decoration, although they show accuratly where you are scrolled to in the area. TODO: Pass mouse input to scrollbars. --- desktop/textarea.c | 428 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 310 insertions(+), 118 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index e782fd6fd..185a878d9 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -29,6 +29,7 @@ #include "desktop/textarea.h" #include "desktop/textinput.h" #include "desktop/plotters.h" +#include "desktop/scrollbar.h" #include "render/font.h" #include "utils/log.h" #include "utils/utf8.h" @@ -49,34 +50,34 @@ struct line_info { struct textarea { - int scroll_x, scroll_y; /**< scroll offsets of the textarea - * content - */ + int scroll_x, scroll_y; /**< scroll offsets for the textarea */ + + struct scrollbar *bar_x; /**< Horizontal scroll. */ + struct scrollbar *bar_y; /**< Vertical scroll. */ unsigned int flags; /**< Textarea flags */ int vis_width; /**< Visible width, in pixels */ int vis_height; /**< Visible height, in pixels */ - int pad_top; - int pad_right; - int pad_bottom; - int pad_left; + int pad_top; /**< Top padding, inside border, in pixels */ + int pad_right; /**< Right padding, inside border, in pixels */ + int pad_bottom; /**< Bottom padding, inside border, in pixels */ + int pad_left; /**< Left padding, inside border, in pixels */ - int border_width; - colour border_col; + int border_width; /**< Border width, in pixels */ + colour border_col; /**< Border colour */ - plot_font_style_t fstyle; /**< Text style */ - plot_font_style_t sel_fstyle; /**< Text style */ + plot_font_style_t fstyle; /**< Text style, inc. textarea bg col */ + plot_font_style_t sel_fstyle; /**< Selected text style */ char *text; /**< UTF-8 text */ unsigned int text_alloc; /**< Size of allocated text */ unsigned int text_len; /**< Length of text, in bytes */ unsigned int text_utf8_len; /**< Length of text, in characters - * without the trailing NUL */ + * without the trailing NULL */ struct { int line; /**< Line caret is on */ - int char_off; /**< Character index of caret within the - * specified line */ + int char_off; /**< Character index of caret on line */ } caret_pos; int caret_x; /**< cached X coordinate of the caret */ @@ -85,6 +86,8 @@ struct textarea { int sel_start; /**< Character index of sel start(inclusive) */ int sel_end; /**< Character index of sel end(exclusive) */ + int h_extent; /**< Width of content in px */ + int v_extent; /**< Height of content in px */ int line_count; /**< Count of lines */ #define LINE_CHUNK_SIZE 16 struct line_info *lines; /**< Line info array */ @@ -228,7 +231,11 @@ static bool textarea_select_fragment(struct textarea * ta) */ static bool textarea_scroll_visible(struct textarea *ta) { - int x0, x1, y0, y1, x, y; + int x0, x1, y0, y1; /* area we want caret inside */ + int xc, yc; /* area centre */ + int x, y; /* caret pos */ + int xs = ta->scroll_x; + int ys = ta->scroll_y; bool scrolled = false; if (ta->caret_pos.char_off == -1) @@ -237,58 +244,114 @@ static bool textarea_scroll_visible(struct textarea *ta) x0 = ta->border_width + ta->pad_left; x1 = ta->vis_width - (ta->border_width + ta->pad_right); y0 = 0; - y1 = ta->vis_height - 2 * ta->border_width; - - x = ta->caret_x - ta->scroll_x; - y = ta->caret_y - ta->scroll_y; + y1 = ta->vis_height - 2 * ta->border_width - + ta->pad_top - ta->pad_bottom; + xc = (x1 - x0) / 2 + x0; + yc = (y1 - y0) / 2 + y0; + + x = ta->caret_x - xs; + y = ta->caret_y + ta->line_height / 2 - ys; + + /* horizontal scroll; centre caret */ + xs += x - xc; + + /* force back into range */ + if (xs < 0) + xs = 0; + else if (xs > ta->h_extent - (x1 - x0)) + xs = ta->h_extent - (x1 - x0); + + /* If scrolled, set new pos. */ + if (xs != ta->scroll_x && ta->bar_x != NULL) { + scrollbar_set(ta->bar_x, xs, false); + ta->scroll_x = scrollbar_get_offset(ta->bar_x); + scrolled = true; - /* check and change vertical scroll */ - if (y < y0) { - ta->scroll_y -= y0 - y; + } else if (ta->flags & TEXTAREA_MULTILINE && ta->bar_x == NULL && + ta->scroll_x != 0) { + ta->scroll_x = 0; scrolled = true; - } else if (y + ta->line_height > y1) { - ta->scroll_y += y + ta->line_height - y1; + + } else if (xs != ta->scroll_x && !(ta->flags & TEXTAREA_MULTILINE)) { + ta->scroll_x = xs; scrolled = true; } - - /* check and change horizontal scroll */ - if (x < x0) { - ta->scroll_x -= x0 - x ; - scrolled = true; - } else if (x > x1) { - ta->scroll_x += x - x1; - scrolled = true; + /* check and change vertical scroll */ + if (ta->flags & TEXTAREA_MULTILINE) { + /* vertical scroll; centre caret */ + ys += y - yc; + + /* force back into range */ + if (ys < 0) + ys = 0; + else if (ys > ta->v_extent - (y1 - y0)) + ys = ta->v_extent - (y1 - y0); + + /* If scrolled, set new pos. */ + if (ys != ta->scroll_y && ta->bar_y != NULL) { + scrollbar_set(ta->bar_y, ys, false); + ta->scroll_y = scrollbar_get_offset(ta->bar_y); + scrolled = true; + + } else if (ta->bar_y == NULL && ta->scroll_y != 0) { + ta->scroll_y = 0; + scrolled = true; + } } return scrolled; } +/** + * Callback for scrollbar widget. + */ +static void textarea_scrollbar_callback(void *client_data, + struct scrollbar_msg_data *scrollbar_data) +{ + struct textarea *ta = client_data; + + switch(scrollbar_data->msg) { + case SCROLLBAR_MSG_MOVED: + /* Scrolled; redraw everything */ + ta->scroll_x = scrollbar_get_offset(ta->bar_x); + ta->scroll_y = scrollbar_get_offset(ta->bar_y); + + ta->redraw_request(ta->data, 0, 0, + ta->vis_width, + ta->vis_height); + break; + case SCROLLBAR_MSG_SCROLL_START: + /* TODO: Tell textarea client we're handling a drag */ + break; + case SCROLLBAR_MSG_SCROLL_FINISHED: + /* TODO: Tell textarea client drag finished */ + break; + } +} + + /** * Reflow a text area from the given line onwards * * \param ta Text area to reflow - * \param line Line number to begin reflow on + * \param start Line number to begin reflow on * \return true on success false otherwise */ -static bool textarea_reflow(struct textarea *ta, unsigned int line) +static bool textarea_reflow(struct textarea *ta, unsigned int start) { char *text; unsigned int len; size_t b_off; int x; char *space, *para_end; - unsigned int line_count = 0; - int avail_width = ta->vis_width - 2 * ta->border_width - - ta->pad_left - ta->pad_right; - if (avail_width < 0) - avail_width = 0; - - /** \todo pay attention to line parameter */ - /** \todo create horizontal scrollbar if needed */ - - ta->line_count = 0; + unsigned int line; /* line count */ + unsigned int scroll_lines; + int avail_width; + int h_extent; /* horizontal extent */ + int v_extent; /* vertical extent */ + bool restart; if (ta->lines == NULL) { ta->lines = @@ -301,78 +364,190 @@ static bool textarea_reflow(struct textarea *ta, unsigned int line) if (!(ta->flags & TEXTAREA_MULTILINE)) { /* Single line */ - ta->lines[line_count].b_start = 0; - ta->lines[line_count++].b_length = ta->text_len - 1; + int w = ta->vis_width - 2 * ta->border_width - + ta->pad_left - ta->pad_right; + ta->lines[0].b_start = 0; + ta->lines[0].b_length = ta->text_len - 1; - ta->line_count = line_count; + nsfont.font_width(&ta->fstyle, ta->text, ta->text_len, &x); + if (x > w) + w = x; + ta->h_extent = w + ta->pad_left - ta->pad_right; + ta->line_count = 1; return true; } - for (len = ta->text_len - 1, text = ta->text; len > 0; - len -= b_off, text += b_off) { + /* Find max number of lines before vertical scrollbar is required */ + scroll_lines = (ta->vis_height - 2 * ta->border_width - + ta->pad_top - ta->pad_bottom) / + ta->line_height; + + if ((signed)start > ta->line_count) + start = 0; + /** \todo pay attention to start param, for now force start at zero */ + start = 0; + + do { + /* Set line count to start point */ + line = start; + + /* Find available width */ + avail_width = ta->vis_width - 2 * ta->border_width - + ta->pad_left - ta->pad_right; + if (avail_width < 0) + avail_width = 0; + h_extent = avail_width; + + restart = false; + for (len = ta->text_len - 1, text = ta->text; len > 0; + len -= b_off, text += b_off) { + + /* Find end of paragraph */ + for (para_end = text; para_end < text + len; + para_end++) { + if (*para_end == '\n') + break; + } + + /* Wrap current line in paragraph */ + nsfont.font_split(&ta->fstyle, text, para_end - text, + avail_width, &b_off, &x); + /* b_off now marks space, or end of paragraph */ - /* Find end of paragraph */ - for (para_end = text; para_end < text + len; para_end++) { - if (*para_end == '\n') - break; - } + if (x > h_extent) { + h_extent = x; + } + if (x > avail_width && ta->bar_x == NULL) { + /* We need to insert a horizontal scrollbar */ + int w = ta->vis_width - 2 * ta->border_width; + if (!scrollbar_create(true, w, w, w, + ta, textarea_scrollbar_callback, + &(ta->bar_x))) + return false; + if (ta->bar_y != NULL) + scrollbar_make_pair(ta->bar_x, + ta->bar_y); + ta->pad_bottom += SCROLLBAR_WIDTH; + + /* Find new max visible lines */ + scroll_lines = (ta->vis_height - + 2 * ta->border_width - + ta->pad_top - ta->pad_bottom) / + ta->line_height; + } - /* Wrap current line in paragraph */ - nsfont.font_split(&ta->fstyle, text, para_end - text, - avail_width, &b_off, &x); + if (line > 0 && line % LINE_CHUNK_SIZE == 0) { + struct line_info *temp = realloc(ta->lines, + (line + LINE_CHUNK_SIZE) * + sizeof(struct line_info)); + if (temp == NULL) { + LOG(("realloc failed")); + return false; + } - if (b_off == 0) { - /* Text wasn't split */ - b_off = para_end - text; - } - /* b_off now marks space, or end of paragraph */ - - if (line_count > 0 && line_count % LINE_CHUNK_SIZE == 0) { - struct line_info *temp = realloc(ta->lines, - (line_count + LINE_CHUNK_SIZE) * - sizeof(struct line_info)); - if (temp == NULL) { - LOG(("realloc failed")); - return false; + ta->lines = temp; } - ta->lines = temp; - } + if (para_end == text + b_off && *para_end == '\n') { + /* Not found any spaces to wrap at, and we + * have a newline char */ + ta->lines[line].b_start = text - ta->text; + ta->lines[line++].b_length = para_end - text; + + /* Jump newline */ + b_off++; + + if (len - b_off == 0) { + /* reached end of input; + * add last line */ + ta->lines[line].b_start = + text + b_off - ta->text; + ta->lines[line++].b_length = 0; + } - if (para_end == text + b_off && *para_end == '\n') { - /* Not found any spaces to wrap at, and we - * have a newline char */ - ta->lines[line_count].b_start = text - ta->text; - ta->lines[line_count++].b_length = para_end - text; + if (line > scroll_lines && ta->bar_y == NULL) + break; + + continue; - /* Jump newline */ - b_off++; + } else if (len - b_off > 0) { + /* soft wraped, find last space (if any) */ + for (space = text + b_off; space > text; + space--) { + if (*space == ' ') + break; + } - if (len - b_off == 0) { - /* reached end of input => add last line */ - ta->lines[line_count].b_start = - text + b_off - ta->text; - ta->lines[line_count++].b_length = 0; + if (space != text) + b_off = space + 1 - text; } - continue; + ta->lines[line].b_start = text - ta->text; + ta->lines[line++].b_length = b_off; - } else if (len - b_off > 0) { - /* soft wraped, find last space (if any) */ - for (space = text + b_off; space > text; space--) - if (*space == ' ') - break; + if (line > scroll_lines && ta->bar_y == NULL) + break; + } + + if (h_extent <= avail_width && ta->bar_x != NULL) { + /* We need to remove a horizontal scrollbar */ + scrollbar_destroy(ta->bar_x); + ta->bar_x = NULL; + ta->pad_bottom -= SCROLLBAR_WIDTH; - if (space != text) - b_off = space + 1 - text; + /* Find new max visible lines */ + scroll_lines = (ta->vis_height - 2 * ta->border_width - + ta->pad_top - ta->pad_bottom) / + ta->line_height; } - ta->lines[line_count].b_start = text - ta->text; - ta->lines[line_count++].b_length = b_off; + if (line > scroll_lines && ta->bar_y == NULL) { + /* Add vertical scrollbar */ + int h = ta->vis_height - 2 * ta->border_width; + if (!scrollbar_create(false, h, h, h, + ta, textarea_scrollbar_callback, + &(ta->bar_y))) + return false; + if (ta->bar_x != NULL) + scrollbar_make_pair(ta->bar_x, + ta->bar_y); + ta->pad_right += SCROLLBAR_WIDTH; + restart = true; + + } else if (line <= scroll_lines && ta->bar_y != NULL) { + /* Remove vertical scrollbar */ + scrollbar_destroy(ta->bar_y); + ta->bar_y = NULL; + ta->pad_right -= SCROLLBAR_WIDTH; + restart = true; + } + } while (restart); + + h_extent += ta->pad_left + ta->pad_right - + (ta->bar_y != NULL ? SCROLLBAR_WIDTH : 0); + v_extent = line * ta->line_height + ta->pad_top + + ta->pad_bottom - + (ta->bar_x != NULL ? SCROLLBAR_WIDTH : 0); + + if (ta->bar_x != NULL) { + /* Set horizontal scrollbar extents */ + int w = ta->vis_width - 2 * ta->border_width - + (ta->bar_y != NULL ? SCROLLBAR_WIDTH : 0); + scrollbar_set_extents(ta->bar_x, w, w, h_extent); } - ta->line_count = line_count; + if (ta->bar_y != NULL) { + /* Set vertical scrollbar extents */ + int h = ta->vis_height - 2 * ta->border_width; + scrollbar_set_extents(ta->bar_y, h, + h - (ta->bar_x != NULL ? SCROLLBAR_WIDTH : 0), + v_extent); + } + + ta->h_extent = h_extent; + ta->v_extent = v_extent; + ta->line_count = line; return true; } @@ -641,6 +816,8 @@ struct textarea *textarea_create(const textarea_setup *setup, ret->scroll_x = 0; ret->scroll_y = 0; + ret->bar_x = NULL; + ret->bar_y = NULL; ret->drag_start_char = 0; @@ -676,6 +853,10 @@ struct textarea *textarea_create(const textarea_setup *setup, /* exported interface, documented in textarea.h */ void textarea_destroy(struct textarea *ta) { + if (ta->bar_x) + scrollbar_destroy(ta->bar_x); + if (ta->bar_y) + scrollbar_destroy(ta->bar_y); free(ta->text); free(ta->lines); free(ta); @@ -811,13 +992,8 @@ bool textarea_set_caret(struct textarea *ta, int caret) y = ta->line_height * ta->caret_pos.line; ta->caret_y = y; - if (textarea_scroll_visible(ta)) { - /* Scrolled; redraw everything */ - ta->redraw_request(ta->data, 0, 0, - ta->vis_width, - ta->vis_height); - } else { - /* Just caret moved, redraw it */ + if (!textarea_scroll_visible(ta)) { + /* No scroll, just caret moved, redraw it */ x -= ta->scroll_x; y -= ta->scroll_y; x0 = max(x - 1, ta->border_width); @@ -939,8 +1115,10 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, r.x1 = x + ta->vis_width - ta->border_width; if (r.y0 < y + ta->border_width) r.y0 = y + ta->border_width; - if (r.y1 > y + ta->vis_width - ta->border_width) - r.y1 = y + ta->vis_height - ta->border_width; + if (r.y1 > y + ta->vis_height - ta->border_width - + (ta->bar_x != NULL ? SCROLLBAR_WIDTH : 0)) + r.y1 = y + ta->vis_height - ta->border_width - + (ta->bar_x != NULL ? SCROLLBAR_WIDTH : 0); if (line0 > 0) c_pos = utf8_bounded_length(ta->text, @@ -977,7 +1155,7 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, ta->lines[line].b_length); b_end = 0; - right = x + ta->border_width + ta->pad_left; + right = x + ta->border_width + ta->pad_left - ta->scroll_x; do { sel_start = ta->sel_start; @@ -1028,7 +1206,8 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, left = right; nsfont.font_width(&ta->fstyle, line_text, b_end, &right); - right += x + ta->border_width + ta->pad_left; + right += x + ta->border_width + ta->pad_left - + ta->scroll_x; /* set clip rectangle for line part */ s = r; @@ -1040,10 +1219,10 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, if (selected) { /* draw selection fill */ - plot->rectangle(s.x0 - ta->scroll_x, + plot->rectangle(s.x0, y + line * ta->line_height + 1 - ta->scroll_y + text_y_offset, - s.x1 - ta->scroll_x, + s.x1, y + (line + 1) * ta->line_height + 1 - ta->scroll_y + text_y_offset, &plot_style_fill_bg); @@ -1070,19 +1249,32 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, c_pos++; } - plot->clip(&r); - x -= ta->scroll_x; - y -= ta->scroll_y; + plot->clip(clip); - if (ta->sel_end == -1 || ta->sel_start == ta->sel_end) { + if (ta->sel_end == -1 || ta->sel_start == ta->sel_end && + ta->caret_pos.char_off >= 0) { /* There is no selection; draw caret */ - int caret_y = y + ta->caret_y + text_y_offset; + int caret_y = y - ta->scroll_y + ta->caret_y + text_y_offset; int caret_height = caret_y + ta->line_height; - plot->line(x + ta->caret_x, caret_y, - x + ta->caret_x, caret_height, + plot->line(x - ta->scroll_x + ta->caret_x, caret_y, + x - ta->scroll_x + ta->caret_x, caret_height, &pstyle_stroke_caret); } + + if (ta->bar_x != NULL) + scrollbar_redraw(ta->bar_x, + x + ta->border_width, + y + ta->vis_height - ta->border_width - + SCROLLBAR_WIDTH, + clip, 1.0, ctx); + + if (ta->bar_y != NULL) + scrollbar_redraw(ta->bar_y, + x + ta->vis_width - ta->border_width - + SCROLLBAR_WIDTH, + y + ta->border_width, + clip, 1.0, ctx); } @@ -1352,7 +1544,7 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) break; if (ta->sel_start != -1) { if (!textarea_replace_text(ta, - ta->sel_start, + ta->sel_start, ta->sel_end, "", 0, false)) return false; @@ -1420,7 +1612,7 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) break; if (ta->sel_start != -1) { if (!textarea_replace_text(ta, - ta->sel_start, + ta->sel_start, ta->sel_end, "", 0, false)) return false; ta->sel_start = ta->sel_end = -1; @@ -1440,7 +1632,7 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) break; if (ta->sel_start != -1) { if (!textarea_replace_text(ta, - ta->sel_start, + ta->sel_start, ta->sel_end, "", 0, false)) return false; ta->sel_start = ta->sel_end = -1; -- cgit v1.2.3 From 7a0b3475634642194b256ef3c4a294c72e312a18 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 15 Jan 2013 19:50:36 +0000 Subject: Add parentheses. --- desktop/textarea.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 185a878d9..00c2ca4bc 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -1251,9 +1251,9 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, plot->clip(clip); - if (ta->sel_end == -1 || ta->sel_start == ta->sel_end && + if ((ta->sel_end == -1 || ta->sel_start == ta->sel_end) && ta->caret_pos.char_off >= 0) { - /* There is no selection; draw caret */ + /* There is no selection, and caret visible: draw caret */ int caret_y = y - ta->scroll_y + ta->caret_y + text_y_offset; int caret_height = caret_y + ta->line_height; -- cgit v1.2.3 From d25289695360d16c25e39a022e949c6f56245adc Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 15 Jan 2013 21:05:54 +0000 Subject: Ensure we know for sure if scrollbar widget will want to scroll us. Avoid double xy to offset conversion. --- desktop/textarea.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 00c2ca4bc..d3f031fe1 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -264,8 +264,11 @@ static bool textarea_scroll_visible(struct textarea *ta) /* If scrolled, set new pos. */ if (xs != ta->scroll_x && ta->bar_x != NULL) { scrollbar_set(ta->bar_x, xs, false); - ta->scroll_x = scrollbar_get_offset(ta->bar_x); - scrolled = true; + xs = scrollbar_get_offset(ta->bar_x); + if (xs != ta->scroll_x) { + ta->scroll_x = xs; + scrolled = true; + } } else if (ta->flags & TEXTAREA_MULTILINE && ta->bar_x == NULL && ta->scroll_x != 0) { @@ -291,8 +294,11 @@ static bool textarea_scroll_visible(struct textarea *ta) /* If scrolled, set new pos. */ if (ys != ta->scroll_y && ta->bar_y != NULL) { scrollbar_set(ta->bar_y, ys, false); - ta->scroll_y = scrollbar_get_offset(ta->bar_y); - scrolled = true; + ys = scrollbar_get_offset(ta->bar_y); + if (ys != ta->scroll_y) { + ta->scroll_y = ys; + scrolled = true; + } } else if (ta->bar_y == NULL && ta->scroll_y != 0) { ta->scroll_y = 0; @@ -1673,10 +1679,10 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, /* mouse button pressed above the text area, move caret */ if (mouse & BROWSER_MOUSE_PRESS_1) { if (!(ta->flags & TEXTAREA_READONLY)) { - textarea_set_caret_xy(ta, x, y); - textarea_get_xy_offset(ta, x, y, &b_off, &c_off); ta->drag_start_char = c_off; + + textarea_set_caret(ta, c_off); } if (ta->sel_start != -1) { /* remove selection */ -- cgit v1.2.3 From d899ebb5fa8c2692ddd1de9c91dce7863e0089f1 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 16 Jan 2013 11:54:30 +0000 Subject: Pass correct mouse button for button 2. --- gtk/treeview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/treeview.c b/gtk/treeview.c index efba9c410..1a987989c 100644 --- a/gtk/treeview.c +++ b/gtk/treeview.c @@ -254,7 +254,7 @@ gboolean nsgtk_tree_window_button_press_event(GtkWidget *widget, switch (event->button) { case 1: tw->mouse_state |= BROWSER_MOUSE_PRESS_1; break; - case 3: tw->mouse_state |= BROWSER_MOUSE_PRESS_2; break; + case 2: tw->mouse_state |= BROWSER_MOUSE_PRESS_2; break; } /* Handle the modifiers too */ if (event->state & GDK_SHIFT_MASK) -- cgit v1.2.3 From 5bda4edb1a0d42c4ab3072d3c83526dadd6c0124 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 16 Jan 2013 12:28:11 +0000 Subject: Don't search back for spaces if the whole string fits in available width. --- riscos/font.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/riscos/font.c b/riscos/font.c index 717b9606c..d92d5b521 100644 --- a/riscos/font.c +++ b/riscos/font.c @@ -358,8 +358,9 @@ bool nsfont_split(const plot_font_style_t *fstyle, return false; } - while (*char_offset && string[*char_offset] != ' ') - (*char_offset)--; + if (*char_offset != length) + while (*char_offset && string[*char_offset] != ' ') + (*char_offset)--; code = rufl_width(font_family, font_style, font_size, string, *char_offset, -- cgit v1.2.3 From 3f1c2a831536cb4b89db52162460f25ecaf9d4c8 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 17 Jan 2013 18:50:02 +0000 Subject: OS3 needs PBL too --- amiga/Makefile.target | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amiga/Makefile.target b/amiga/Makefile.target index f2c429998..d7abea5cf 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -59,7 +59,7 @@ else LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib ifeq ($(SUBTARGET),os3) - LDFLAGS += -liconv + LDFLAGS += -lpbl -liconv else LDFLAGS += -lauto -lpbl -liconv endif -- cgit v1.2.3 From 7b62bb5ff89b08820f56df666c8d9616c8c57489 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 16 Jan 2013 13:42:16 +0000 Subject: implement document.compatmode --- javascript/jsapi/htmldocument.bnd | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd index 8d5c69eb5..c948e2dbb 100644 --- a/javascript/jsapi/htmldocument.bnd +++ b/javascript/jsapi/htmldocument.bnd @@ -52,6 +52,9 @@ binding document { /** location instantiated on first use */ property unshared location; + /* compatability mode instantiated on first use */ + property unshared compatMode; + /* events through a single interface */ property unshared type EventHandler; } @@ -66,7 +69,7 @@ api finalise %{ getter location %{ - if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx,vp))) { + if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) { /* already created - return it */ return JS_TRUE; } @@ -95,6 +98,32 @@ getter documentURI %{ jsret = JSVAL_TO_STRING(jsstr); %} + +getter compatMode %{ + /* Returns the string "CSS1Compat" if document is in no-quirks + * mode or limited-quirks mode, and "BackCompat", if document + * is in quirks mode. + */ + if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) { + /* already created, just use it */ + return JS_TRUE; + } + if (private->htmlc->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL) { + jsret = JS_NewStringCopyN(cx, "BackCompat", SLEN("BackCompat")); + } else { + jsret = JS_NewStringCopyN(cx, "CSS1Compat", SLEN("CSS1Compat")); + } + +%} + +/* +getter characterSet %{ +%} + +getter contentType %{ +%} +*/ + getter cookie %{ char *cookie_str; cookie_str = urldb_get_cookie(llcache_handle_get_url(private->htmlc->base.llcache), false); -- cgit v1.2.3 From 5f66864c3a4d1b60abf6c2888d11b41edc8d869d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 17 Jan 2013 19:57:48 +0000 Subject: add macros for default proprty actions --- javascript/jsapi.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/javascript/jsapi.h b/javascript/jsapi.h index e3295fee9..b26eb5572 100644 --- a/javascript/jsapi.h +++ b/javascript/jsapi.h @@ -75,6 +75,8 @@ /* native proprty definition */ +#define JSAPI_PROP_DEFAULT(name, cx, obj, vp) \ + jsapi_property_##name(cx, obj, jsval jsapi_id, vp) #define JSAPI_PROP_GETTER(name, cx, obj, vp) \ jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp) #define JSAPI_PROP_SETTER(name, cx, obj, vp) \ @@ -195,6 +197,8 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, /* proprty native calls */ +#define JSAPI_PROP_DEFAULT(name, cx, obj, vp) \ + jsapi_property_##name(cx, obj, jsval jsapi_id, vp) #define JSAPI_PROP_GETTER(name, cx, obj, vp) \ jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp) #define JSAPI_PROP_SETTER(name, cx, obj, vp) \ @@ -307,6 +311,8 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #define JSAPI_THIS_OBJECT(cx,vp) JS_THIS_OBJECT(cx,vp) /* proprty native calls */ +#define JSAPI_PROP_DEFAULT(name, cx, obj, vp) \ + jsapi_property_##name(cx, obj, jsid jsapi_id, vp) #define JSAPI_PROP_GETTER(name, cx, obj, vp) \ jsapi_property_##name##_get(cx, obj, jsid jsapi_id, vp) #define JSAPI_PROP_SETTER(name, cx, obj, vp) \ -- cgit v1.2.3 From c4e8651b27d2e1ea508164ea432d43286bd67924 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 18 Jan 2013 21:16:47 +0000 Subject: Activate the find window's string gadget on open --- amiga/search.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/amiga/search.c b/amiga/search.c index 1148f6d77..6d5e658f7 100755 --- a/amiga/search.c +++ b/amiga/search.c @@ -174,6 +174,9 @@ void ami_search_open(struct gui_window *gwin) fwin->node = AddObject(window_list,AMINS_FINDWINDOW); fwin->node->objstruct = fwin; gwin->shared->searchwin = fwin; + + ActivateLayoutGadget((struct Gadget *)fwin->objects[GID_MAIN], fwin->win, + NULL, fwin->objects[GID_SEARCHSTRING]); } void ami_search_close(void) -- cgit v1.2.3 From f16229552a06e64df579a1133c5efe571e401748 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 18 Jan 2013 21:20:10 +0000 Subject: Entering the search string now find the first occurence immediately --- amiga/search.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/amiga/search.c b/amiga/search.c index 6d5e658f7..f1fad600b 100755 --- a/amiga/search.c +++ b/amiga/search.c @@ -205,6 +205,26 @@ BOOL ami_search_event(void) case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { + case GID_SEARCHSTRING: + browser_window_search_destroy_context( + fwin->gwin->shared->bw); + ami_search_set_forward_state( + true, NULL); + ami_search_set_back_state( + true, NULL); + + RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_PREV], + fwin->win, NULL, + GA_Disabled, FALSE, + TAG_DONE); + + RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_NEXT], + fwin->win, NULL, + GA_Disabled, FALSE, + TAG_DONE); + + /* fall through */ + case GID_NEXT: search_insert = true; flags = SEARCH_FLAG_FORWARDS | @@ -231,25 +251,6 @@ BOOL ami_search_event(void) flags, ami_search_string()); ActivateWindow(fwin->gwin->shared->win); - break; - - case GID_SEARCHSTRING: - browser_window_search_destroy_context( - fwin->gwin->shared->bw); - ami_search_set_forward_state( - true, NULL); - ami_search_set_back_state( - true, NULL); - - RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_PREV], - fwin->win, NULL, - GA_Disabled, FALSE, - TAG_DONE); - - RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_NEXT], - fwin->win, NULL, - GA_Disabled, FALSE, - TAG_DONE); break; } break; -- cgit v1.2.3 From a6e56546c957f213503333483b383307dda144b9 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 18 Jan 2013 21:58:37 +0000 Subject: Check the right thing for NULL. --- render/textinput.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/render/textinput.c b/render/textinput.c index 71b4e53e0..5fa33c7cf 100644 --- a/render/textinput.c +++ b/render/textinput.c @@ -1385,7 +1385,7 @@ bool textinput_textarea_callback(struct browser_window *bw, uint32_t key, bool success; gui_get_clipboard(&buff, &buff_len); - if (utf8 == NULL) + if (buff == NULL) return false; success = browser_window_paste_text(bw, buff, buff_len, true); @@ -2032,7 +2032,7 @@ bool textinput_input_callback(struct browser_window *bw, uint32_t key, bool success; gui_get_clipboard(&buff, &buff_len); - if (utf8 == NULL) + if (buff == NULL) return false; success = browser_window_paste_text(bw, buff, buff_len, true); -- cgit v1.2.3 From bf7b23506da89669fadfe6628a8aba5fcd36d55a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 18 Jan 2013 22:04:57 +0000 Subject: Make nsfont_split implementation better for core textarea. --- riscos/font.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/riscos/font.c b/riscos/font.c index d92d5b521..326cca973 100644 --- a/riscos/font.c +++ b/riscos/font.c @@ -358,10 +358,23 @@ bool nsfont_split(const plot_font_style_t *fstyle, return false; } - if (*char_offset != length) + if (*char_offset != length) { + /* we found something to split at */ + size_t orig = *char_offset; + + /* ensure a space at <= the split point we found */ while (*char_offset && string[*char_offset] != ' ') (*char_offset)--; + /* nothing valid found <= split point, advance to next space */ + if (*char_offset == 0) { + *char_offset = orig; + while (*char_offset != length && + string[*char_offset] != ' ') + (*char_offset)++; + } + } + code = rufl_width(font_family, font_style, font_size, string, *char_offset, actual_x); -- cgit v1.2.3 From 9995ef583f0820013e4e870f572b794bd46b4b13 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 18 Jan 2013 23:32:53 +0000 Subject: Early scrollbar mouse handling. --- desktop/textarea.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 95 insertions(+), 7 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index d3f031fe1..d10039a2f 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -48,6 +48,18 @@ struct line_info { unsigned int b_length; /**< Byte length of line */ }; +typedef enum textarea_drag_type_internal { + TEXTAREA_DRAG_NONE, + TEXTAREA_DRAG_SCROLLBAR, + TEXTAREA_DRAG_SELECTION +} textarea_drag_type_internal; +struct textarea_drag { + textarea_drag_type_internal type; + union { + struct scrollbar* scrollbar; + } data; +}; + struct textarea { int scroll_x, scroll_y; /**< scroll offsets for the textarea */ @@ -83,8 +95,8 @@ struct textarea { int caret_x; /**< cached X coordinate of the caret */ int caret_y; /**< cached Y coordinate of the caret */ - int sel_start; /**< Character index of sel start(inclusive) */ - int sel_end; /**< Character index of sel end(exclusive) */ + int sel_start; /**< Character index of sel start (inclusive) */ + int sel_end; /**< Character index of sel end (exclusive) */ int h_extent; /**< Width of content in px */ int v_extent; /**< Height of content in px */ @@ -96,9 +108,10 @@ struct textarea { /** Callback function for a redraw request */ textarea_redraw_request_callback redraw_request; - void *data; /** < Callback data for both callback functions */ + void *data; /**< Client data for callback */ - int drag_start_char; /**< Character index of drag start */ + int drag_start_char; /**< Character index of drag start */ + struct textarea_drag drag_info; /**< Drag information */ }; @@ -327,10 +340,16 @@ static void textarea_scrollbar_callback(void *client_data, ta->vis_width, ta->vis_height); break; + case SCROLLBAR_MSG_SCROLL_START: + ta->drag_info.type = TEXTAREA_DRAG_SCROLLBAR; + ta->drag_info.data.scrollbar = + scrollbar_data->scrollbar; /* TODO: Tell textarea client we're handling a drag */ break; + case SCROLLBAR_MSG_SCROLL_FINISHED: + ta->drag_info.type = TEXTAREA_DRAG_NONE; /* TODO: Tell textarea client drag finished */ break; } @@ -825,6 +844,7 @@ struct textarea *textarea_create(const textarea_setup *setup, ret->bar_x = NULL; ret->bar_y = NULL; ret->drag_start_char = 0; + ret->drag_info.type = TEXTAREA_DRAG_NONE; ret->text = malloc(64); @@ -1378,6 +1398,8 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) size_t clipboard_chars; gui_get_clipboard(&clipboard, &clipboard_length); + if (clipboard == NULL) + return false; clipboard_chars = utf8_bounded_length(clipboard, clipboard_length); @@ -1673,9 +1695,51 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, int x, int y) { int c_start, c_end; + int sx, sy; /* xy coord offset for scrollbar */ + int sl; /* scrollbar length */ size_t b_off; unsigned int c_off; + if (ta->drag_info.type == TEXTAREA_DRAG_SCROLLBAR) { + if (ta->drag_info.data.scrollbar == ta->bar_x) { + x -= ta->border_width; + y -= ta->vis_height - ta->border_width - + SCROLLBAR_WIDTH; + } else { + x -= ta->vis_width - ta->border_width - + SCROLLBAR_WIDTH; + y -= ta->border_width; + } + scrollbar_mouse_action(ta->drag_info.data.scrollbar, + mouse, x, y); + return true; + } + + /* Horizontal scrollbar */ + if (ta->bar_x != NULL && ta->drag_info.type == TEXTAREA_DRAG_NONE) { + sx = x - ta->border_width; + sy = y - (ta->vis_height - ta->border_width - SCROLLBAR_WIDTH); + sl = ta->vis_width - 2 * ta->border_width - + (ta->bar_y != NULL ? SCROLLBAR_WIDTH : 0); + + if (sx >= 0 && sy >= 0 && sx < sl && sy < SCROLLBAR_WIDTH) { + scrollbar_mouse_action(ta->bar_x, mouse, sx, sy); + return true; + } + } + + /* Vertical scrollbar */ + if (ta->bar_y != NULL && ta->drag_info.type == TEXTAREA_DRAG_NONE) { + sx = x - (ta->vis_width - ta->border_width - SCROLLBAR_WIDTH); + sy = y - ta->border_width; + sl = ta->vis_height - 2 * ta->border_width; + + if (sx >= 0 && sy >= 0 && sx < SCROLLBAR_WIDTH && sy < sl) { + scrollbar_mouse_action(ta->bar_y, mouse, sx, sy); + return true; + } + } + /* mouse button pressed above the text area, move caret */ if (mouse & BROWSER_MOUSE_PRESS_1) { if (!(ta->flags & TEXTAREA_READONLY)) { @@ -1702,6 +1766,7 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, textarea_get_xy_offset(ta, x, y, &b_off, &c_off); c_start = ta->drag_start_char; c_end = c_off; + ta->drag_info.type = TEXTAREA_DRAG_SELECTION; return textarea_select(ta, c_start, c_end); } @@ -1717,9 +1782,32 @@ bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse, size_t b_off; unsigned int c_off; - textarea_get_xy_offset(ta, x, y, &b_off, &c_off); - c_end = c_off; - return textarea_select(ta, ta->drag_start_char, c_end); + switch (ta->drag_info.type) { + case TEXTAREA_DRAG_SCROLLBAR: + if (ta->drag_info.data.scrollbar == ta->bar_x) { + x -= ta->border_width; + y -= ta->vis_height - ta->border_width - + SCROLLBAR_WIDTH; + } else { + x -= ta->vis_width - ta->border_width - + SCROLLBAR_WIDTH; + y -= ta->border_width; + } + scrollbar_mouse_drag_end(ta->drag_info.data.scrollbar, + mouse, x, y); + return true; + + case TEXTAREA_DRAG_SELECTION: + textarea_get_xy_offset(ta, x, y, &b_off, &c_off); + c_end = c_off; + ta->drag_info.type = TEXTAREA_DRAG_NONE; + return textarea_select(ta, ta->drag_start_char, c_end); + + default: + break; + } + + return false; } -- cgit v1.2.3 From e547026dfa78c3a50818dabfc3be98af31c7735e Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 20 Jan 2013 11:38:26 +0000 Subject: Copy hotlist from the pre-3.0 to the 3.0 location during install, if it exists and there isn't one present in the new location already. --- amiga/dist/Install | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/amiga/dist/Install b/amiga/dist/Install index e32096498..01914294b 100755 --- a/amiga/dist/Install +++ b/amiga/dist/Install @@ -382,6 +382,10 @@ (set #user-options (tackon #user-dir "Choices")) (set #options-exist (exists #user-options)) (set #searchengines-exist (exists (tackon @default-dest "Resources/SearchEngines"))) +(set #user-hotlist (tackon #user-dir "Hotlist")) +(set #hotlist-exist (exists #user-hotlist)) +(set #old-hotlist (tackon @default-dest "Resources/Hotlist")) +(set #old-hotlist-exist (exists #old-hotlist)) (set #aiss-theme "") (if (= #options-exist 0) @@ -411,6 +415,20 @@ ) ) +(if (= #hotlist-exist 0) + (if (= #old-hotlist-exist 1) + ( + (copyfiles + (prompt "Migrating NetSurf 2.x Hotlist") + (help @copyfiles-help) + (source #old-hotlist) + (dest #user-dir) + (optional "askuser" "force" "oknodelete") + ) + ) + ) +) + (complete 18) (if (>= osver 53) -- cgit v1.2.3 From 088cbf5499ff17c9a1d57b443d6ed5e1595ad726 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sun, 20 Jan 2013 12:32:26 +0000 Subject: Require CryptRandom 0.13 or later --- riscos/scripts/Run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/riscos/scripts/Run b/riscos/scripts/Run index f1300f607..45a7748d0 100644 --- a/riscos/scripts/Run +++ b/riscos/scripts/Run @@ -92,8 +92,8 @@ RMEnsure Iconv 0.11 NetSurfRMLoad System:Modules.Iconv RMEnsure Iconv 0.11 Error NetSurf requires Iconv 0.11 or later. This can be downloaded from http://www.netsurf-browser.org/iconv/ | Ensure CryptRandom -RMEnsure CryptRandom 0.12 NetSurfRMLoad System:Modules.CryptRand -RMEnsure CryptRandom 0.12 Error NetSurf requires CryptRandom 0.12 or later. This can be downloaded from http://www.riscos.info/index.php/CryptRandom +RMEnsure CryptRandom 0.13 NetSurfRMLoad System:Modules.CryptRand +RMEnsure CryptRandom 0.13 Error NetSurf requires CryptRandom 0.13 or later. This can be downloaded from http://www.markettos.org.uk/riscos/crypto/ | Disable SpecialFX, if present Set NetSurf$SpecialFX 1 -- cgit v1.2.3 From 2f94b0a949eeceb61a9a06d4d825e54e6fa3f254 Mon Sep 17 00:00:00 2001 From: François Revol Date: Sun, 20 Jan 2013 17:59:55 +0100 Subject: textarea: C89 --- desktop/textarea.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index d10039a2f..e94360e5b 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -1391,12 +1391,13 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) break; case KEY_PASTE: { - if (readonly) - break; char *clipboard; size_t clipboard_length; size_t clipboard_chars; + if (readonly) + break; + gui_get_clipboard(&clipboard, &clipboard_length); if (clipboard == NULL) return false; -- cgit v1.2.3 From 87946c5de8eae4fdcff8155f59d2a01c3784b7c8 Mon Sep 17 00:00:00 2001 From: François Revol Date: Sun, 20 Jan 2013 18:00:36 +0100 Subject: beos: Fix clipboard handling to use the new API --- beos/scaffolding.cpp | 6 ++-- beos/window.cpp | 82 ++++++++++++++-------------------------------------- 2 files changed, 24 insertions(+), 64 deletions(-) diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp index bcd9943ba..709795b53 100644 --- a/beos/scaffolding.cpp +++ b/beos/scaffolding.cpp @@ -812,13 +812,13 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m break; } case B_COPY: - gui_copy_to_clipboard(browser_window_get_selection(bw)); + browser_window_key_press(bw, KEY_COPY_SELECTION); break; case B_CUT: - browser_window_key_press(bw, 24); + browser_window_key_press(bw, KEY_CUT_SELECTION); break; case B_PASTE: - gui_paste_from_clipboard(scaffold->top_level, 0, 0); + browser_window_key_press(bw, KEY_PASTE); break; case B_SELECT_ALL: LOG(("Selecting all text")); diff --git a/beos/window.cpp b/beos/window.cpp index f26ba9191..d187e333b 100644 --- a/beos/window.cpp +++ b/beos/window.cpp @@ -1662,12 +1662,6 @@ void gui_drag_save_selection(struct selection *s, struct gui_window *g) void gui_start_selection(struct gui_window *g) { - current_selection.Truncate(0); - while (current_selection_textruns.ItemAt(0)) { - text_run *run = (text_run *)current_selection_textruns.RemoveItem(0L); - delete run; - } - if (!g->view->LockLooper()) return; @@ -1680,9 +1674,12 @@ void gui_clear_selection(struct gui_window *g) { } -void gui_paste_from_clipboard(struct gui_window *g, int x, int y) +void gui_get_clipboard(char **buffer, size_t *length) { BMessage *clip; + *length = 0; + *buffer = NULL; + if (be_clipboard->Lock()) { clip = be_clipboard->Data(); if (clip) { @@ -1690,84 +1687,47 @@ void gui_paste_from_clipboard(struct gui_window *g, int x, int y) int32 textlen; if (clip->FindData("text/plain", B_MIME_TYPE, (const void **)&text, &textlen) >= B_OK) { - browser_window_paste_text(g->bw,text,textlen,true); + *buffer = (char *)malloc(textlen); + *length = textlen; + memcpy(*buffer, text, textlen); } } be_clipboard->Unlock(); } } -bool gui_empty_clipboard(void) -{ - current_selection.Truncate(0); - while (current_selection_textruns.ItemAt(0)) { - text_run *run = (text_run *)current_selection_textruns.RemoveItem(0L); - delete run; - } - return true; -} - -bool gui_add_to_clipboard(const char *text, size_t length, bool space, - const plot_font_style_t *fstyle) -{ - BString s; - BFont font; - text_run *run = new text_run; - - nsbeos_style_to_font(font, fstyle); - run->offset = current_selection.Length(); - run->font = font; - run->color = nsbeos_rgb_colour(fstyle->foreground); - current_selection_textruns.AddItem(run); - - s.SetTo(text, length); - current_selection << s; - if (space) - current_selection << " "; - return true; -} - -bool gui_commit_clipboard(void) +void gui_set_clipboard(const char *buffer, size_t length, + nsclipboard_styles styles[], int n_styles) { BMessage *clip; - if (current_selection.Length() == 0) - return true; - if (be_clipboard->Lock()) { be_clipboard->Clear(); clip = be_clipboard->Data(); if (clip) { - clip->AddData("text/plain", B_MIME_TYPE, - current_selection.String(), - current_selection.Length()); + clip->AddData("text/plain", B_MIME_TYPE, buffer, length); + int arraySize = sizeof(text_run_array) + - current_selection_textruns.CountItems() * sizeof(text_run); + n_styles * sizeof(text_run); text_run_array *array = (text_run_array *)malloc(arraySize); - array->count = current_selection_textruns.CountItems(); - for (int i = 0; i < array->count; i++) - memcpy(&array->runs[i], current_selection_textruns.ItemAt(i), - sizeof(text_run)); + array->count = n_styles; + for (int i = 0; i < n_styles; i++) { + BFont font; + nsbeos_style_to_font(font, &styles[i].style); + array->runs[i].offset = styles[i].start; + array->runs[i].font = font; + array->runs[i].color = + nsbeos_rgb_colour(styles[i].style.foreground); + } clip->AddData("application/x-vnd.Be-text_run_array", B_MIME_TYPE, array, arraySize); free(array); - - gui_empty_clipboard(); be_clipboard->Commit(); } be_clipboard->Unlock(); } - return true; } -bool gui_copy_to_clipboard(struct selection *s) -{ - if (s->defined && selection_copy_to_clipboard(s)) - gui_commit_clipboard(); - return true; -} - - void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, bool scaled) { -- cgit v1.2.3 From def45f8e55c7cc88c292a7194454efc73a46b974 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 21 Jan 2013 20:03:03 +0000 Subject: Ensure buff is NULL-initialised. --- render/textinput.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/render/textinput.c b/render/textinput.c index 5fa33c7cf..e9c6df7b2 100644 --- a/render/textinput.c +++ b/render/textinput.c @@ -1380,7 +1380,7 @@ bool textinput_textarea_callback(struct browser_window *bw, uint32_t key, case KEY_PASTE: { - char *buff; + char *buff = NULL; size_t buff_len; bool success; @@ -2027,7 +2027,7 @@ bool textinput_input_callback(struct browser_window *bw, uint32_t key, case KEY_PASTE: { - char *buff; + char *buff = NULL; size_t buff_len; bool success; -- cgit v1.2.3 From 64ae9e8693aaaf09cb4e35b63d029d446ef361b0 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Tue, 22 Jan 2013 08:51:58 +0000 Subject: Fix paste. Store clipboard as UTF-8 internally, to avoid unnecessary data loss when copying internally. --- riscos/gui.c | 37 +++++++- riscos/textselection.c | 232 ++++++++++++++++++++++++++++++++++++++----------- riscos/textselection.h | 8 ++ riscos/window.c | 11 ++- 4 files changed, 234 insertions(+), 54 deletions(-) diff --git a/riscos/gui.c b/riscos/gui.c index de5dc4af4..e786f67d8 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -1282,6 +1282,22 @@ void ro_gui_drag_end(wimp_dragged *drag) * Handle Key_Pressed events. */ +static void ro_gui_keypress_cb(void *pw) +{ + wimp_key *key = (wimp_key *) pw; + + if (ro_gui_wimp_event_keypress(key) == false) { + os_error *error = xwimp_process_key(key->c); + if (error) { + LOG(("xwimp_process_key: 0x%x: %s", + error->errnum, error->errmess)); + warn_user("WimpError", error->errmess); + } + } + + free(key); +} + void ro_gui_keypress(wimp_key *key) { if (key->c == wimp_KEY_ESCAPE && @@ -1292,8 +1308,17 @@ void ro_gui_keypress(wimp_key *key) (easier than finding somewhere safe to abort the drag) */ ro_gui_drag_box_cancel(); gui_current_drag_type = GUI_DRAG_NONE; - } - else if (!ro_gui_wimp_event_keypress(key)) { + } else if (key->c == 22 /* Ctrl-V */) { + wimp_key *copy; + + /* Must copy the keypress as it's on the stack */ + copy = malloc(sizeof(wimp_key)); + if (copy == NULL) + return; + memcpy(copy, key, sizeof(wimp_key)); + + ro_gui_selection_prepare_paste(key->w, ro_gui_keypress_cb, copy); + } else if (ro_gui_wimp_event_keypress(key) == false) { os_error *error = xwimp_process_key(key->c); if (error) { LOG(("xwimp_process_key: 0x%x: %s", @@ -1320,9 +1345,10 @@ void ro_gui_user_message(wimp_event_no event, wimp_message *message) if (event == wimp_USER_MESSAGE_ACKNOWLEDGE) { if (ro_print_current_window) ro_print_dataload_bounce(message); - } - else + } else if (ro_gui_selection_prepare_paste_dataload( + (wimp_full_message_data_xfer *) message) == false) { ro_msg_dataload(message); + } break; case message_DATA_LOAD_ACK: @@ -1772,6 +1798,9 @@ void ro_msg_datasave(wimp_message *message) ro_msg_terminate_filename(dataxfer); + if (ro_gui_selection_prepare_paste_datasave(dataxfer)) + return; + switch (dataxfer->file_type) { case FILETYPE_ACORN_URI: case FILETYPE_ANT_URL: diff --git a/riscos/textselection.c b/riscos/textselection.c index d1d4340b7..0cb8eb2c0 100644 --- a/riscos/textselection.c +++ b/riscos/textselection.c @@ -56,11 +56,17 @@ static bool drag_claimed = false; static bool owns_clipboard = false; static bool owns_caret_and_selection = false; -/* current clipboard contents if we own the clipboard */ +/* Current clipboard contents if we own the clipboard + * Current paste buffer if we don't + */ static char *clipboard = NULL; -static size_t clip_alloc = 0; static size_t clip_length = 0; +/* Paste context */ +static ro_gui_selection_prepare_paste_cb paste_cb = NULL; +static void *paste_cb_pw = NULL; +static int paste_prev_message = 0; + static void ro_gui_discard_clipboard_contents(void); static void ro_gui_dragging_bounced(wimp_message *message); @@ -207,22 +213,21 @@ void gui_clear_selection(struct gui_window *g) void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles) { - utf8_convert_ret res; char *new_cb; if (length == 0) return; - /* Convert to local encoding */ - res = utf8_to_local_encoding(buffer, length, &new_cb); - - if (res != UTF8_CONVERT_OK || new_cb == NULL) + new_cb = malloc(length); + if (new_cb == NULL) return; - /* Replace existing clipboard contents with converted text */ + memcpy(new_cb, buffer, length); + + /* Replace existing clipboard contents */ free(clipboard); clipboard = new_cb; - clip_alloc = clip_length = strlen(new_cb); + clip_length = length; if (!owns_clipboard) { /* Tell RO we now own clipboard */ @@ -253,7 +258,7 @@ void gui_set_clipboard(const char *buffer, size_t length, /** * Core asks front end for clipboard contents. * - * \param buffer UTF-8 text, allocated by front end, ownership yeilded to core + * \param buffer UTF-8 text, allocated by front end, ownership yielded to core * \param length Byte length of UTF-8 text in buffer */ void gui_get_clipboard(char **buffer, size_t *length) @@ -261,64 +266,180 @@ void gui_get_clipboard(char **buffer, size_t *length) *buffer = NULL; *length = 0; - if (owns_clipboard) { - if (clip_length > 0) { - char *utf8; - utf8_convert_ret ret; - /* Clipboard is in local encoding so - * convert to UTF8 */ - ret = utf8_from_local_encoding(clipboard, - clip_length, &utf8); - if (ret == UTF8_CONVERT_OK) { - *buffer = utf8; - *length = strlen(utf8); - } + if (clip_length > 0) { + char *cb = malloc(clip_length); + if (cb != NULL) { + memcpy(cb, clipboard, clip_length); + *buffer = cb; + *length = clip_length; } - } else { - /** TODO: Handle case when we don't own the clipboard */ + } +} + -/* http://www.starfighter.acornarcade.com/mysite/articles/SelectionModel.html +/** + * Discard the current contents of the clipboard, if any, releasing the + * memory it uses. */ -/* wimp_full_message_data_request msg; - os_error *error; - os_coord pos; +void ro_gui_discard_clipboard_contents(void) +{ + free(clipboard); + clip_length = 0; +} + - if (!ro_gui_window_to_screen_pos(g, x, y, &pos)) - return; +static void ro_gui_selection_prepare_paste_complete(void) +{ + ro_gui_selection_prepare_paste_cb cb = paste_cb; + void *pw = paste_cb_pw; + + paste_cb = NULL; + paste_cb_pw = NULL; + paste_prev_message = 0; + + cb(pw); +} + +static void ro_gui_selection_prepare_paste_bounced(wimp_message *message) +{ + ro_gui_selection_prepare_paste_complete(); +} + +/** + * Prepare to paste data from another application + * + * \param w Window being pasted into + * \param cb Callback to call once preparation is complete + * \param pw Private data for callback + */ + +void ro_gui_selection_prepare_paste(wimp_w w, + ro_gui_selection_prepare_paste_cb cb, void *pw) +{ + if (owns_clipboard) { + /* We own the clipboard: we're already prepared */ + cb(pw); + } else { + /* Someone else owns the clipboard: request its contents */ + wimp_full_message_data_request msg; + bool success; + + ro_gui_discard_clipboard_contents(); msg.size = sizeof(msg); msg.your_ref = 0; msg.action = message_DATA_REQUEST; - msg.w = g->window; + msg.w = w; msg.i = -1; - msg.pos.x = pos.x; - msg.pos.y = pos.y; + msg.pos.x = 0; + msg.pos.y = 0; msg.flags = wimp_DATA_REQUEST_CLIPBOARD; msg.file_types[0] = osfile_TYPE_TEXT; msg.file_types[1] = ~0; - error = xwimp_send_message(wimp_USER_MESSAGE, - (wimp_message*)&msg, wimp_BROADCAST); - if (error) { - LOG(("xwimp_send_message: 0x%x : %s", - error->errnum, error->errmess)); - warn_user("WimpError", error->errmess); + success = ro_message_send_message(wimp_USER_MESSAGE_RECORDED, + (wimp_message *) &msg, wimp_BROADCAST, + ro_gui_selection_prepare_paste_bounced); + if (success == false) { + /* Ensure key is handled, anyway */ + cb(pw); + } else { + /* Set up paste context */ + paste_cb = cb; + paste_cb_pw = pw; + paste_prev_message = msg.my_ref; } -*/ } + } } - /** - * Discard the current contents of the clipboard, if any, releasing the - * memory it uses. + * Prepare to paste data from another application (step 2) + * + * \param dataxfer DataSave message + * \return True if message was handled, false otherwise */ +bool ro_gui_selection_prepare_paste_datasave( + wimp_full_message_data_xfer *dataxfer) +{ + bool success; -void ro_gui_discard_clipboard_contents(void) + /* Ignore messages that aren't for us */ + if (dataxfer->your_ref == 0 || dataxfer->your_ref != paste_prev_message) + return false; + + /* We're done if the paste data isn't text */ + if (dataxfer->file_type != osfile_TYPE_TEXT) { + ro_gui_selection_prepare_paste_complete(); + return true; + } + + /* Generate and send DataSaveAck */ + dataxfer->your_ref = dataxfer->my_ref; + dataxfer->size = offsetof(wimp_full_message_data_xfer, file_name) + 16; + dataxfer->action = message_DATA_SAVE_ACK; + dataxfer->est_size = -1; + memcpy(dataxfer->file_name, "", SLEN("") + 1); + + success = ro_message_send_message(wimp_USER_MESSAGE_RECORDED, + (wimp_message *) dataxfer, dataxfer->sender, + ro_gui_selection_prepare_paste_bounced); + if (success == false) { + ro_gui_selection_prepare_paste_complete(); + } else { + paste_prev_message = dataxfer->my_ref; + } + + return true; +} + + +/** + * Prepare to paste data from another application (step 3) + * + * \param dataxfer DataLoad message + * \return True if message was handled, false otherwise + */ +bool ro_gui_selection_prepare_paste_dataload( + wimp_full_message_data_xfer *dataxfer) { - if (clip_alloc) free(clipboard); - clip_alloc = 0; - clip_length = 0; + FILE *fp; + long size; + char *local_cb; + utf8_convert_ret ret; + + /* Ignore messages that aren't for us */ + if (dataxfer->your_ref == 0 || dataxfer->your_ref != paste_prev_message) + return false; + + fp = fopen(dataxfer->file_name, "r"); + if (fp != NULL) { + fseek(fp, 0, SEEK_END); + size = ftell(fp); + fseek(fp, 0, SEEK_SET); + + local_cb = malloc(size); + if (local_cb != NULL) { + fread(local_cb, 1, size, fp); + + fclose(fp); + + ret = utf8_from_local_encoding(local_cb, size, + &clipboard); + if (ret == UTF8_CONVERT_OK) { + clip_length = strlen(clipboard); + } + } + } + + /* Send DataLoadAck */ + dataxfer->action = message_DATA_LOAD_ACK; + dataxfer->your_ref = dataxfer->my_ref; + ro_message_send_message(wimp_USER_MESSAGE, + (wimp_message *) dataxfer, dataxfer->sender, NULL); + + ro_gui_selection_prepare_paste_complete(); + return true; } @@ -398,18 +519,31 @@ void ro_gui_selection_data_request(wimp_full_message_data_request *req) bool ro_gui_save_clipboard(const char *path) { + char *local_cb; + utf8_convert_ret ret; os_error *error; assert(clip_length > 0 && clipboard); + + ret = utf8_to_local_encoding(clipboard, clip_length, &local_cb); + if (ret != UTF8_CONVERT_OK) { + warn_user("SaveError", "Could not convert"); + return false; + } + error = xosfile_save_stamped(path, osfile_TYPE_TEXT, - (byte*)clipboard, - (byte*)clipboard + clip_length); + (byte*) local_cb, + (byte*) local_cb + strlen(local_cb)); + + free(local_cb); + if (error) { LOG(("xosfile_save_stamped: 0x%x: %s", error->errnum, error->errmess)); warn_user("SaveError", error->errmess); return false; } + return true; } diff --git a/riscos/textselection.h b/riscos/textselection.h index 544636ec2..a3763b46e 100644 --- a/riscos/textselection.h +++ b/riscos/textselection.h @@ -26,6 +26,14 @@ #include "oslib/wimp.h" #include "desktop/gui.h" +typedef void (*ro_gui_selection_prepare_paste_cb)(void *pw); + +void ro_gui_selection_prepare_paste(wimp_w w, + ro_gui_selection_prepare_paste_cb cb, void *pw); +bool ro_gui_selection_prepare_paste_datasave( + wimp_full_message_data_xfer *dataxfer); +bool ro_gui_selection_prepare_paste_dataload( + wimp_full_message_data_xfer *dataxfer); void ro_gui_selection_drag_end(struct gui_window *g, wimp_dragged *drag); void ro_gui_selection_claim_entity(wimp_full_message_claim_entity *claim); diff --git a/riscos/window.c b/riscos/window.c index 535105459..2f8bec614 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -74,6 +74,7 @@ #include "riscos/oslib_pre7.h" #include "riscos/save.h" #include "riscos/content-handlers/sprite.h" +#include "riscos/textselection.h" #include "riscos/toolbar.h" #include "riscos/thumbnail.h" #include "riscos/url_complete.h" @@ -2600,6 +2601,14 @@ void ro_gui_window_menu_warning(wimp_w w, wimp_i i, wimp_menu *menu, } +static void ro_gui_window_paste_cb(void *pw) +{ + struct browser_window *bw = pw; + + browser_window_key_press(bw, KEY_PASTE); +} + + /** * Handle selections from a browser window menu * @@ -2833,7 +2842,7 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu, browser_window_key_press(bw, KEY_CUT_SELECTION); break; case BROWSER_SELECTION_PASTE: - browser_window_key_press(bw, KEY_PASTE); + ro_gui_selection_prepare_paste(w, ro_gui_window_paste_cb, bw); break; case BROWSER_SELECTION_ALL: browser_window_key_press(bw, KEY_SELECT_ALL); -- cgit v1.2.3 From fc6f04161e614521cff67f7bbaf70dbea0332f4d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 22 Jan 2013 18:58:22 +0000 Subject: simplify jsapi property compatability macros --- javascript/jsapi.h | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/javascript/jsapi.h b/javascript/jsapi.h index b26eb5572..b308ca531 100644 --- a/javascript/jsapi.h +++ b/javascript/jsapi.h @@ -75,12 +75,9 @@ /* native proprty definition */ -#define JSAPI_PROP_DEFAULT(name, cx, obj, vp) \ +#define JSAPI_PROP(name, cx, obj, vp) \ jsapi_property_##name(cx, obj, jsval jsapi_id, vp) -#define JSAPI_PROP_GETTER(name, cx, obj, vp) \ - jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp) -#define JSAPI_PROP_SETTER(name, cx, obj, vp) \ - jsapi_property_##name##_set(cx, obj, jsval jsapi_id, vp) +#define JSAPI_STRICTPROP JSAPI_PROP /* native property return value */ #define JSAPI_PROP_RVAL(cx, vp) (*(vp)) @@ -195,14 +192,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, - /* proprty native calls */ -#define JSAPI_PROP_DEFAULT(name, cx, obj, vp) \ +#define JSAPI_PROP(name, cx, obj, vp) \ jsapi_property_##name(cx, obj, jsval jsapi_id, vp) -#define JSAPI_PROP_GETTER(name, cx, obj, vp) \ - jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp) -#define JSAPI_PROP_SETTER(name, cx, obj, vp) \ - jsapi_property_##name##_set(cx, obj, jsval jsapi_id, vp) +#define JSAPI_STRICTPROP JSAPI_PROP /* native property return value */ #define JSAPI_PROP_RVAL JS_RVAL @@ -311,12 +304,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #define JSAPI_THIS_OBJECT(cx,vp) JS_THIS_OBJECT(cx,vp) /* proprty native calls */ -#define JSAPI_PROP_DEFAULT(name, cx, obj, vp) \ +#define JSAPI_PROP(name, cx, obj, vp) \ jsapi_property_##name(cx, obj, jsid jsapi_id, vp) -#define JSAPI_PROP_GETTER(name, cx, obj, vp) \ - jsapi_property_##name##_get(cx, obj, jsid jsapi_id, vp) -#define JSAPI_PROP_SETTER(name, cx, obj, vp) \ - jsapi_property_##name##_set(cx, obj, jsid jsapi_id, JSBool strict, vp) +#define JSAPI_STRICTPROP(name, cx, obj, vp) \ + jsapi_property_##name(cx, obj, jsid jsapi_id, JSBool strict, vp) /* native property return value */ #define JSAPI_PROP_RVAL JS_RVAL -- cgit v1.2.3 From 9b568abf96defa0194f4fcb6e68d008c6e28423e Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 22 Jan 2013 18:59:10 +0000 Subject: add default property handler for array indexing --- javascript/jsapi/nodelist.bnd | 41 ++++++++++++++++++++++++++++++----- test/js/dom-getElementsByTagName.html | 10 +++++++++ 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/javascript/jsapi/nodelist.bnd b/javascript/jsapi/nodelist.bnd index 4aa8c47f5..d7adafd93 100644 --- a/javascript/jsapi/nodelist.bnd +++ b/javascript/jsapi/nodelist.bnd @@ -39,6 +39,41 @@ binding nodelist { private "struct html_content *" htmlc; } +api finalise %{ + if (private != NULL) { + dom_nodelist_unref(private->nodelist); + } +%} + +/* default handler for numericaly indexed property values */ +api getproperty %{ + jsval queryprop; + int idx; + JSObject *jsret = NULL; /* Node */ + dom_exception err; + dom_node *domnode; + + JSAPI_PROP_IDVAL(cx, &queryprop); + if (JSVAL_IS_INT(queryprop)) { + idx = JSVAL_TO_INT(queryprop); + LOG(("Index was %d", idx)); + + + err = dom_nodelist_item(private->nodelist, idx, &domnode); + if (err != DOM_NO_ERR) { + return JS_FALSE; + } + + if (domnode != NULL) { + jsret = jsapi_new_HTMLElement(cx, NULL, NULL, (dom_element *)domnode, private->htmlc); + + JSLOG("return object:%p", jsret); + + JSAPI_PROP_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsret)); + } + } +%} + getter length %{ dom_exception err; @@ -62,9 +97,3 @@ operation item %{ } %} -api finalise %{ - if (private != NULL) { - dom_nodelist_unref(private->nodelist); - } -%} - diff --git a/test/js/dom-getElementsByTagName.html b/test/js/dom-getElementsByTagName.html index 02cdffc4d..2f03e7b46 100644 --- a/test/js/dom-getElementsByTagName.html +++ b/test/js/dom-getElementsByTagName.html @@ -15,6 +15,16 @@ for (var i=0;i +
+

+ -- cgit v1.2.3 From faddd8b0350e3c55555437d19e0148b30bd018ad Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 12:37:56 +0000 Subject: implement Element::getAttribute --- javascript/jsapi/htmlelement.bnd | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 5e22f7e7d..62c08c0a9 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -126,6 +126,29 @@ api finalise %{ /* interface Element in dom idl */ +/* DOMString? Element::getAttribute(DOMString name); */ +operation getAttribute %{ + dom_string *value; + dom_string *name_dom; + dom_exception exc; + + exc = dom_string_create((unsigned char*)name, name_len, &name_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + exc = dom_element_get_attribute(private->node, name_dom, &value); + dom_string_unref(name_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + if (value != NULL) { + jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value)); + dom_string_unref(value); + } +%} + /* * DOM 3 has these as the element traversal extension * -- cgit v1.2.3 From 31f7af700f64070bb5826fd86f6d2af19589669d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 13:42:43 +0000 Subject: implement Element::setAttribute --- javascript/jsapi/htmlelement.bnd | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 62c08c0a9..f0032fa1a 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -149,6 +149,31 @@ operation getAttribute %{ } %} +/* void Element::setAttribute(DOMString name, DOMString value); */ +operation setAttribute %{ + dom_string *value_dom; + dom_string *name_dom; + dom_exception exc; + + exc = dom_string_create((unsigned char*)name, name_len, &name_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + exc = dom_string_create((unsigned char*)name, name_len, &value_dom); + if (exc != DOM_NO_ERR) { + dom_string_unref(name_dom); + return JS_FALSE; + } + + exc = dom_element_set_attribute(private->node, name_dom, value_dom); + dom_string_unref(name_dom); + dom_string_unref(value_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } +%} + /* * DOM 3 has these as the element traversal extension * -- cgit v1.2.3 From fab7b04de689fdbb03e4cf604b1524a80bb4a174 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 14:11:41 +0000 Subject: implement Element::getElementsByTagName --- javascript/jsapi/htmldocument.bnd | 1 + javascript/jsapi/htmlelement.bnd | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd index c948e2dbb..ec7a18039 100644 --- a/javascript/jsapi/htmldocument.bnd +++ b/javascript/jsapi/htmldocument.bnd @@ -219,6 +219,7 @@ operation getElementById %{ * Dom 4 says this should return a htmlcollection, libdom currently * returns DOM 3 spec of a nodelist */ +/* HTMLCollection Document::getElementsByTagName(DOMString localName); */ operation getElementsByTagName %{ dom_string *localName_dom; /* dom_html_collection *collection;*/ diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index f0032fa1a..5af2d5b25 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -174,6 +174,44 @@ operation setAttribute %{ } %} +/* + * + * Dom 4 says this should return a htmlcollection, libdom currently + * returns DOM 3 spec of a nodelist + */ +/* HTMLCollection Element::getElementsByTagName(DOMString localName); */ +operation getElementsByTagName %{ + dom_string *localName_dom; + /* dom_html_collection *collection;*/ + dom_nodelist *nodelist; + dom_exception exc; + + exc = dom_string_create((uint8_t *)localName, localName_len, &localName_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + exc = dom_element_get_elements_by_tag_name(private->node, localName_dom, /*&collection*/&nodelist); + dom_string_unref(localName_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + if (/*collection*/nodelist != NULL) { + /*jsret = jsapi_new_HTMLCollection(cx, + NULL, + NULL, + collection, + private->htmlc);*/ + jsret = jsapi_new_NodeList(cx, + NULL, + NULL, + nodelist, + private->htmlc); + } + +%} + /* * DOM 3 has these as the element traversal extension * -- cgit v1.2.3 From 1d0835098134a68add69146c822cc079da374f30 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 15:42:49 +0000 Subject: implement Element::tagName --- javascript/jsapi/htmlelement.bnd | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 5af2d5b25..fd3a9caf8 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -114,6 +114,9 @@ binding htmlelement { private "dom_element *" node; private "struct html_content *" htmlc; + /* tag name retrieved first time its fetched and doesnt change */ + property unshared tagName; + /* events through a single interface */ property unshared type EventHandler; } @@ -126,6 +129,23 @@ api finalise %{ /* interface Element in dom idl */ +/* readonly attribute DOMString Element::tagName; */ +getter tagName %{ + if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) { + /* already created - return it */ + return JS_TRUE; + } + + dom_exception exc; + dom_string *name; + + exc = dom_element_get_tag_name(private->node, &name); + if (name != NULL) { + jsret = JS_NewStringCopyN(cx, dom_string_data(name), dom_string_length(name)); + dom_string_unref(name); + } +%} + /* DOMString? Element::getAttribute(DOMString name); */ operation getAttribute %{ dom_string *value; -- cgit v1.2.3 From db7d3acdc3b7256728bf5dcfce8ef04a8d32b65b Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 15:49:46 +0000 Subject: add and use debug logging macro --- javascript/jsapi.h | 5 +++++ javascript/jsapi/htmldocument.bnd | 18 +++++++++--------- javascript/jsapi/htmlelement.bnd | 1 + javascript/jsapi/nodelist.bnd | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/javascript/jsapi.h b/javascript/jsapi.h index b308ca531..e38188ab4 100644 --- a/javascript/jsapi.h +++ b/javascript/jsapi.h @@ -376,5 +376,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #endif #define JSLOG(args...) LOG((args)) +#ifdef ENABLE_VERBOSE_JS_DEBUG +#define JSDBG(args...) LOG((args)) +#else +#define JSDBG(args...) +#endif #endif diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd index ec7a18039..4aacccf4e 100644 --- a/javascript/jsapi/htmldocument.bnd +++ b/javascript/jsapi/htmldocument.bnd @@ -173,7 +173,7 @@ getter body %{ dom_node *body; dom_exception exc; - JSLOG("Getting your body"); + JSDBG("Getting your body"); /* document (html) element */ exc = dom_document_get_document_element(private->node, &element); @@ -189,7 +189,7 @@ getter body %{ dom_node_unref(element); } - JSLOG("returning jsobject %p",jsret); + JSDBG("returning jsobject %p",jsret); %} @@ -266,7 +266,7 @@ operation createTextNode %{ if (data != NULL) { - JSLOG("Creating text node for string \"%s\"", data); + JSDBG("Creating text node for string \"%s\"", data); exc = dom_string_create((unsigned char*)data, data_len, &data_dom); if (exc != DOM_NO_ERR) { return JS_FALSE; @@ -281,7 +281,7 @@ operation createTextNode %{ jsret = jsapi_new_Text(cx, NULL, NULL, text, private->htmlc); } - JSLOG("returning jsobject %p",jsret); + JSDBG("returning jsobject %p",jsret); %} @@ -293,7 +293,7 @@ operation createComment %{ if (data != NULL) { - JSLOG("Creating string \"%s\"", data); + JSDBG("Creating string \"%s\"", data); exc = dom_string_create((unsigned char*)data, data_len, &data_dom); @@ -301,7 +301,7 @@ operation createComment %{ return JS_FALSE; } - JSLOG("Creating comment object for dom string \"%s\"", + JSDBG("Creating comment object for dom string \"%s\"", dom_string_data(data_dom)); exc = dom_document_create_comment(private->node, data_dom, @@ -314,7 +314,7 @@ operation createComment %{ jsret = jsapi_new_Comment(cx, NULL, NULL, comment, private->htmlc); } - JSLOG("returning jsobject %p", jsret); + JSDBG("returning jsobject %p", jsret); %} @@ -325,7 +325,7 @@ operation createElement %{ dom_element *element; if (localName != NULL) { - JSLOG("Creating text node for string \"%s\"", localName); + JSDBG("Creating text node for string \"%s\"", localName); exc = dom_string_create((unsigned char*)localName, localName_len, &localName_dom); if (exc != DOM_NO_ERR) { return JS_FALSE; @@ -340,7 +340,7 @@ operation createElement %{ jsret = jsapi_new_HTMLElement(cx, NULL, NULL, element, private->htmlc); } - JSLOG("returning jsobject %p",jsret); + JSDBG("returning jsobject %p",jsret); %} diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index fd3a9caf8..56c98258b 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -29,6 +29,7 @@ preamble %{ #include "htmlelement.h" #include "text.h" #include "location.h" +#include "nodelist.h" %} diff --git a/javascript/jsapi/nodelist.bnd b/javascript/jsapi/nodelist.bnd index d7adafd93..379809659 100644 --- a/javascript/jsapi/nodelist.bnd +++ b/javascript/jsapi/nodelist.bnd @@ -56,7 +56,7 @@ api getproperty %{ JSAPI_PROP_IDVAL(cx, &queryprop); if (JSVAL_IS_INT(queryprop)) { idx = JSVAL_TO_INT(queryprop); - LOG(("Index was %d", idx)); + JSDBG("Index was %d", idx); err = dom_nodelist_item(private->nodelist, idx, &domnode); @@ -67,7 +67,7 @@ api getproperty %{ if (domnode != NULL) { jsret = jsapi_new_HTMLElement(cx, NULL, NULL, (dom_element *)domnode, private->htmlc); - JSLOG("return object:%p", jsret); + JSDBG("return object:%p", jsret); JSAPI_PROP_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsret)); } -- cgit v1.2.3 From 16d938dd63b1003daafcbead03779eb587dc823d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 16:28:35 +0000 Subject: implement Element::id --- javascript/jsapi/htmlelement.bnd | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 56c98258b..3a6b01760 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -147,6 +147,22 @@ getter tagName %{ } %} +/* attribute DOMString Element::id; */ +getter id %{ + dom_string *value; + dom_exception exc; + + exc = dom_element_get_attribute(private->node, corestring_dom_id, &value); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + if (value != NULL) { + jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value)); + dom_string_unref(value); + } +%} + /* DOMString? Element::getAttribute(DOMString name); */ operation getAttribute %{ dom_string *value; -- cgit v1.2.3 From 7ab835df8f45fcea7f12eafe422021b8232b5dd8 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 17:00:13 +0000 Subject: implement Element::className --- javascript/jsapi/htmlelement.bnd | 16 ++++++++++++++++ utils/corestrings.c | 3 +++ utils/corestrings.h | 1 + 3 files changed, 20 insertions(+) diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 3a6b01760..9af6f2bb5 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -163,6 +163,22 @@ getter id %{ } %} +/* attribute DOMString Element::className; */ +getter className %{ + dom_string *value; + dom_exception exc; + + exc = dom_element_get_attribute(private->node, corestring_dom_class, &value); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + if (value != NULL) { + jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value)); + dom_string_unref(value); + } +%} + /* DOMString? Element::getAttribute(DOMString name); */ operation getAttribute %{ dom_string *value; diff --git a/utils/corestrings.c b/utils/corestrings.c index 65666df66..f39a59c21 100644 --- a/utils/corestrings.c +++ b/utils/corestrings.c @@ -134,6 +134,7 @@ dom_string *corestring_dom_cellpadding; dom_string *corestring_dom_cellspacing; dom_string *corestring_dom_change; dom_string *corestring_dom_charset; +dom_string *corestring_dom_class; dom_string *corestring_dom_click; dom_string *corestring_dom_close; dom_string *corestring_dom_color; @@ -357,6 +358,7 @@ void corestrings_fini(void) CSS_DOM_STRING_UNREF(cellspacing); CSS_DOM_STRING_UNREF(change); CSS_DOM_STRING_UNREF(charset); + CSS_DOM_STRING_UNREF(class); CSS_DOM_STRING_UNREF(click); CSS_DOM_STRING_UNREF(close); CSS_DOM_STRING_UNREF(color); @@ -611,6 +613,7 @@ nserror corestrings_init(void) CSS_DOM_STRING_INTERN(cellspacing); CSS_DOM_STRING_INTERN(change); CSS_DOM_STRING_INTERN(charset); + CSS_DOM_STRING_INTERN(class); CSS_DOM_STRING_INTERN(click); CSS_DOM_STRING_INTERN(close); CSS_DOM_STRING_INTERN(color); diff --git a/utils/corestrings.h b/utils/corestrings.h index 08d254501..e28b713eb 100644 --- a/utils/corestrings.h +++ b/utils/corestrings.h @@ -140,6 +140,7 @@ extern struct dom_string *corestring_dom_cellpadding; extern struct dom_string *corestring_dom_cellspacing; extern struct dom_string *corestring_dom_change; extern struct dom_string *corestring_dom_charset; +extern struct dom_string *corestring_dom_class; extern struct dom_string *corestring_dom_click; extern struct dom_string *corestring_dom_close; extern struct dom_string *corestring_dom_color; -- cgit v1.2.3 From 09dc0649df1b0dd97e4c13aef3c41870eeff5572 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 17:11:40 +0000 Subject: implement Element::removeAttribute --- javascript/jsapi/htmlelement.bnd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 9af6f2bb5..c0a7f0410 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -227,6 +227,23 @@ operation setAttribute %{ } %} +/* void Element::removeAttribute(DOMString name); */ +operation removeAttribute %{ + dom_string *name_dom; + dom_exception exc; + + exc = dom_string_create((unsigned char*)name, name_len, &name_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + exc = dom_element_remove_attribute(private->node, name_dom); + dom_string_unref(name_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } +%} + /* * * Dom 4 says this should return a htmlcollection, libdom currently -- cgit v1.2.3 From 67ffb8e6e97a5572f1033a7326f8ecc232b17201 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 17:46:40 +0000 Subject: implement Element::hasAttribute --- javascript/jsapi/htmlelement.bnd | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index c0a7f0410..33b495195 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -244,6 +244,28 @@ operation removeAttribute %{ } %} +/* boolean Element::hasAttribute(DOMString name); */ +operation hasAttribute %{ + bool result; + dom_string *name_dom; + dom_exception exc; + + exc = dom_string_create((unsigned char*)name, name_len, &name_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + exc = dom_element_has_attribute(private->node, name_dom, &result); + dom_string_unref(name_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + if (result) { + jsret = JS_TRUE; + } +%} + /* * * Dom 4 says this should return a htmlcollection, libdom currently -- cgit v1.2.3 From db71ffc8eae9a857e92310f5aba665adb058ff4c Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 24 Jan 2013 19:22:01 +0000 Subject: AmigaGuide class provided by Daniel Jedlicka --- amiga/agclass/amigaguide_class.c | 347 +++++++++++++++++++++++++++++++++++++++ amiga/agclass/amigaguide_class.h | 40 +++++ 2 files changed, 387 insertions(+) create mode 100755 amiga/agclass/amigaguide_class.c create mode 100755 amiga/agclass/amigaguide_class.h diff --git a/amiga/agclass/amigaguide_class.c b/amiga/agclass/amigaguide_class.c new file mode 100755 index 000000000..a4bebd00e --- /dev/null +++ b/amiga/agclass/amigaguide_class.c @@ -0,0 +1,347 @@ +/* + * AmigaGuide Class + * A BOOPSI class for displaying AmigaGuide files. + * by Daniel "Trixie" Jedlicka + */ + + +#include "amigaguide_class.h" + + + +struct localObjectData +{ + struct NewAmigaGuide nag; + struct AmigaGuideMsg *agm; + AMIGAGUIDECONTEXT agHandle; + uint32 agContextID; + uint32 agSignal; + BOOL agActive; +}; + +struct Library *AmigaGuideBase = NULL; +struct AmigaGuideIFace *IAmigaGuide = NULL; + + +/* ********************************** function prototypes ************************************ */ + +static uint32 dispatchAGClass(Class *, Object *, Msg); +BOOL freeAGClass(Class *); + +// class methods +uint32 om_new(Class *, Object *, struct opSet *); +uint32 om_dispose(Class *, Object *, Msg); +uint32 om_set(Class *, Object *, struct opSet *); +uint32 om_get(Class *, Object *, struct opGet *); +uint32 agm_open(Class *, Object *, Msg); +uint32 agm_close(Class *, Object *, Msg); + + +/* *************************** class initialization and disposal ***************************** */ + + +Class *initAGClass(void) +{ + Class *cl = NULL; + + + // Open amigaguide.library and its interface. + if ( (AmigaGuideBase = IExec->OpenLibrary("amigaguide.library", 52)) ) + { + if ( (IAmigaGuide = (struct AmigaGuideIFace *)IExec->GetInterface(AmigaGuideBase, "main", 1L, NULL)) ) + { + if ( (cl = IIntuition->MakeClass(NULL, "rootclass", NULL, sizeof(struct localObjectData), 0)) ) + { + cl->cl_Dispatcher.h_Entry = (HOOKFUNC)dispatchAGClass; + IIntuition->AddClass(cl); + } + else freeAGClass(NULL); + } + else freeAGClass(NULL); + } + + return cl; + +} + + + +BOOL freeAGClass(Class *cl) +{ + BOOL retVal = FALSE; + + + // Close amigaguide.library and free the class. + if (IAmigaGuide) IExec->DropInterface((struct Interface *)IAmigaGuide); + if (AmigaGuideBase) IExec->CloseLibrary(AmigaGuideBase); + if (cl) retVal = IIntuition->FreeClass(cl); + + return retVal; +} + + + +/* ************************************** class dispatcher ************************************ */ + + +static uint32 dispatchAGClass(Class *cl, Object *o, Msg msg) +{ + + switch (msg->MethodID) + { + case OM_NEW: + return om_new(cl, o, (struct opSet *)msg); + + case OM_DISPOSE: + return om_dispose(cl, o, msg); + + case OM_UPDATE: + case OM_SET: + return om_set(cl, o, (struct opSet *)msg); + + case OM_GET: + return om_get(cl, o, (struct opGet *)msg); + + case AGM_OPEN: + return agm_open(cl, o, msg); + + case AGM_CLOSE: + return agm_close(cl, o, msg); + + default: + return IIntuition->IDoSuperMethodA(cl, o, msg); + } + +} + + +/* *************************************** class methods ************************************** */ + +uint32 om_new(Class *cl, Object *o, struct opSet *msg) +{ + struct localObjectData *lod = NULL; + uint32 retVal = 0L; + + + if ( (retVal = IIntuition->IDoSuperMethodA(cl, o, (Msg)msg)) ) + { + // Obtain pointer to our object's local instance data. + if ( (lod = (struct localObjectData *)INST_DATA(cl, retVal)) ) + { + // Initialize values. + lod->agActive = FALSE; + lod->agHandle = NULL; + lod->agContextID = 0; + lod->nag.nag_Name = NULL; + lod->nag.nag_Screen = NULL; + lod->nag.nag_PubScreen = NULL; + lod->nag.nag_BaseName = NULL; + lod->nag.nag_Context = NULL; + lod->nag.nag_Client = NULL; // private, must be NULL! + + // Set initial object attributes based on the tags from NewObject(). + om_set(cl, (Object *)retVal, msg); + } + } + + return retVal; + +} + + + + + +uint32 om_dispose(Class *cl, Object *o, Msg msg) +{ + + // Close the document, should it still be opened. + agm_close(cl, o, msg); + + // Let superclass dispose of the object. + return IIntuition->IDoSuperMethodA(cl, o, msg); + +} + + + + + +uint32 om_set(Class *cl, Object *o, struct opSet *msg) +{ + struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o); + struct TagItem *tags, *ti; + + + tags = msg->ops_AttrList; + + while ((ti = IUtility->NextTagItem (&tags))) + { + switch (ti->ti_Tag) + { + case AMIGAGUIDE_Name: + lod->nag.nag_Name = (STRPTR)ti->ti_Data; + lod->agActive = FALSE; // Database name has changed, we must setup the help system again. + break; + + case AMIGAGUIDE_Screen: + lod->nag.nag_Screen = (struct Screen *)ti->ti_Data; + lod->agActive = FALSE; // Screen pointer has changed, we must setup the help system again. + break; + + case AMIGAGUIDE_PubScreen: + lod->nag.nag_PubScreen = (STRPTR)ti->ti_Data; + lod->agActive = FALSE; // Pubscreen name has changed, we must setup the help system again. + break; + + case AMIGAGUIDE_BaseName: + lod->nag.nag_BaseName = (STRPTR)ti->ti_Data; + lod->agActive = FALSE; // Application basename has changed, we must setup the help system again. + break; + + case AMIGAGUIDE_ContextArray: + lod->nag.nag_Context = (STRPTR *)ti->ti_Data; + lod->agActive = FALSE; // Context array has changed, we must setup the help system again. + break; + + case AMIGAGUIDE_ContextID: + lod->agContextID = (uint32)ti->ti_Data; + break; + + default: + break; + } + } + + + // Setup the help system, if not ready yet or needs changing. + if ( lod->agActive == FALSE ) + { + // Shut down help system should it already be running. + if ( lod->agHandle ) agm_close(cl, o, (Msg)msg); + + // (Re)establish the AmigaGuide context and open the database asynchronously. + if ( (lod->agHandle = IAmigaGuide->OpenAmigaGuideAsync(&(lod->nag), NULL)) ) + { + if ( (lod->agSignal = IAmigaGuide->AmigaGuideSignal(lod->agHandle)) ) + { + // Wait until the help system is up and running. + IExec->Wait(lod->agSignal); + while ( !(lod->agActive) ) + { + while ( (lod->agm = IAmigaGuide->GetAmigaGuideMsg(lod->agHandle)) ) + { + // The AmigaGuide process started OK. + if ( lod->agm->agm_Type == ActiveToolID ) lod->agActive = TRUE; + + // Opening the guide file failed for some reason, continue as usual. + if ( lod->agm->agm_Type == ToolStatusID && lod->agm->agm_Pri_Ret ) lod->agActive = TRUE; + + IAmigaGuide->ReplyAmigaGuideMsg(lod->agm); + } + } + } + } + } + + return (uint32)lod->agHandle; + +} + + + + + +uint32 om_get(Class *cl, Object *o, struct opGet *msg) +{ + struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o); + uint32 retVal = 0L; + + + switch (msg->opg_AttrID) + { + case AMIGAGUIDE_Name: + *(msg->opg_Storage) = (uint32)lod->nag.nag_Name; + retVal = 1; + break; + + case AMIGAGUIDE_Screen: + *(msg->opg_Storage) = (uint32)lod->nag.nag_Screen; + retVal = 1; + break; + + case AMIGAGUIDE_PubScreen: + *(msg->opg_Storage) = (uint32)lod->nag.nag_PubScreen; + retVal = 1; + break; + + case AMIGAGUIDE_BaseName: + *(msg->opg_Storage) = (uint32)lod->nag.nag_BaseName; + retVal = 1; + break; + + case AMIGAGUIDE_ContextArray: + *(msg->opg_Storage) = (uint32)lod->nag.nag_Context; + retVal = 1; + break; + + case AMIGAGUIDE_ContextID: + *(msg->opg_Storage) = (uint32)lod->agContextID; + retVal = 1; + break; + + default: + retVal = IIntuition->IDoSuperMethodA(cl, o, (Msg)msg); + } + + return retVal; + +} + + + + + +uint32 agm_open(Class *cl, Object *o, Msg msg) +{ + struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o); + uint32 retVal = 0; + + + if ( (lod->agHandle) && (lod->agActive) ) + { + if ( lod->nag.nag_Context ) + { + // A context node array is provided = open the current context node. + IAmigaGuide->SetAmigaGuideContext(lod->agHandle, lod->agContextID, NULL); + retVal = IAmigaGuide->SendAmigaGuideContext(lod->agHandle, NULL); + } + else + { + // No context array is provided = open the main node. + retVal = IAmigaGuide->SendAmigaGuideCmd(lod->agHandle, "LINK MAIN", TAG_DONE); + } + } + + return retVal; +} + + + + + +uint32 agm_close(Class *cl, Object *o, Msg msg) +{ + struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o); + + + if ( lod->agHandle ) + { + IAmigaGuide->CloseAmigaGuide(lod->agHandle); + lod->agHandle = NULL; + lod->agActive = FALSE; + } + + return (uint32)lod->agHandle; + +} diff --git a/amiga/agclass/amigaguide_class.h b/amiga/agclass/amigaguide_class.h new file mode 100755 index 000000000..f122f35f7 --- /dev/null +++ b/amiga/agclass/amigaguide_class.h @@ -0,0 +1,40 @@ +/* + * AmigaGuide Class + * + */ + +#ifndef AMIGAGUIDE_CLASS_H +#define AMIGAGUIDE_CLASS_H + +#include +#include + +#include + +#include +#include +#include +#include + + + +// tag definitions +#define AMIGAGUIDE_Dummy (TAG_USER+0x05000000) + +#define AMIGAGUIDE_Name (AMIGAGUIDE_Dummy + 1) // Name of the AmigaGuide database. +#define AMIGAGUIDE_Screen (AMIGAGUIDE_Dummy + 2) // Pointer of the screen to open on. +#define AMIGAGUIDE_PubScreen (AMIGAGUIDE_Dummy + 3) // Name of the public screen to open on. +#define AMIGAGUIDE_BaseName (AMIGAGUIDE_Dummy + 4) // Basename of the application that opens the help file. +#define AMIGAGUIDE_ContextArray (AMIGAGUIDE_Dummy + 5) // Context node array (must be NULL-terminated). +#define AMIGAGUIDE_ContextID (AMIGAGUIDE_Dummy + 6) // Index value of the node to display. + +// method definition +#define AGM_OPEN WM_OPEN +#define AGM_CLOSE WM_CLOSE + +// function prototypes +Class *initAGClass(void); +BOOL freeAGClass(Class *); + +#endif // AMIGAGUIDE_CLASS_H + -- cgit v1.2.3 From 18091ec1a9ab94db511ff0c01e590e1a8aa533f9 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 24 Jan 2013 20:00:09 +0000 Subject: Add basic context-sensitive help. --- amiga/Makefile.target | 5 +-- amiga/agclass/amigaguide_class.c | 3 +- amiga/gui.c | 10 ++++++ amiga/gui_options.c | 11 +++++++ amiga/help.c | 66 ++++++++++++++++++++++++++++++++++++++++ amiga/help.h | 36 ++++++++++++++++++++++ 6 files changed, 127 insertions(+), 4 deletions(-) create mode 100755 amiga/help.c create mode 100755 amiga/help.h diff --git a/amiga/Makefile.target b/amiga/Makefile.target index d7abea5cf..dc79479c5 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -75,11 +75,12 @@ EXETARGET := NetSurf S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \ thumbnail.c misc.c bitmap.c font.c filetype.c utf8.c login.c \ plotters.c object.c menu.c save_pdf.c arexx.c version.c \ - cookies.c context_menu.c clipboard.c \ + cookies.c context_menu.c clipboard.c help.c font_scan.c \ launch.c search.c history_local.c download.c iff_dr2d.c \ sslcert.c gui_options.c print.c theme.c drag.c icon.c system_colour.c \ datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \ - stringview/stringview.c stringview/urlhistory.c font_scan.c + stringview/stringview.c stringview/urlhistory.c \ + agclass/amigaguide_class.c S_AMIGA := $(addprefix amiga/,$(S_AMIGA)) # This is the final source build list diff --git a/amiga/agclass/amigaguide_class.c b/amiga/agclass/amigaguide_class.c index a4bebd00e..dfac7ad7a 100755 --- a/amiga/agclass/amigaguide_class.c +++ b/amiga/agclass/amigaguide_class.c @@ -4,11 +4,10 @@ * by Daniel "Trixie" Jedlicka */ +#undef __USE_INLINE__ #include "amigaguide_class.h" - - struct localObjectData { struct NewAmigaGuide nag; diff --git a/amiga/gui.c b/amiga/gui.c index 08408b0a8..e544dbd60 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -53,6 +53,7 @@ #include "amiga/font.h" #include "amiga/gui.h" #include "amiga/gui_options.h" +#include "amiga/help.h" #include "amiga/history.h" #include "amiga/history_local.h" #include "amiga/hotlist.h" @@ -385,6 +386,7 @@ void ami_open_resources(void) TAG_DONE))) die(messages_get("NoMemory")); ami_file_req_init(); + ami_help_init(NULL); } void ami_set_options(void) @@ -666,6 +668,8 @@ void ami_openscreen(void) gui_system_colour_finalize(); gui_system_colour_init(); + + ami_help_new_screen(scrn); } void ami_openscreenfirst(void) @@ -1002,6 +1006,7 @@ int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie) else nskey = KEY_TAB; break; case RAWKEY_F5: + case RAWKEY_HELP: // don't translate nskey = keycode; break; @@ -1823,6 +1828,10 @@ void ami_handle_msg(void) if(browser_window_reload_available(gwin->bw)) browser_window_reload(gwin->bw,false); break; + + case RAWKEY_HELP: // help + ami_help_open(AMI_HELP_GUI); + break; } } } @@ -2410,6 +2419,7 @@ void gui_quit(void) FreeSysObject(ASOT_PORT,appport); FreeSysObject(ASOT_PORT,sport); + ami_help_free(); ami_file_req_free(); ami_openurl_close(); diff --git a/amiga/gui_options.c b/amiga/gui_options.c index d2478d67f..7e4cef584 100755 --- a/amiga/gui_options.c +++ b/amiga/gui_options.c @@ -33,6 +33,7 @@ #include "amiga/font.h" #include "amiga/gui.h" #include "amiga/gui_options.h" +#include "amiga/help.h" #include "amiga/theme.h" #include "amiga/utf8.h" #include "utils/messages.h" @@ -1890,6 +1891,16 @@ BOOL ami_gui_opts_event(void) return TRUE; break; + case WMHI_GADGETHELP: + if((result & WMHI_GADGETMASK) == 0) { + /* Pointer not over our window */ + ami_help_open(AMI_HELP_MAIN); + } else { + /* TODO: Make this sensitive to the tab the user is currently on */ + ami_help_open(AMI_HELP_PREFS); + } + break; + case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { diff --git a/amiga/help.c b/amiga/help.c new file mode 100755 index 000000000..214e59d96 --- /dev/null +++ b/amiga/help.c @@ -0,0 +1,66 @@ +/* + * Copyright 2013 Chris Young + * + * 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 . + */ + +#include "amiga/help.h" + +/* AmigaGuide class */ +#include "amiga/agclass/amigaguide_class.h" + +Class *AmigaGuideClass = NULL; +Object *AmigaGuideObject = NULL; + +/* This array needs to match the enum in help.h */ +STRPTR context_nodes[] = { + "Main", + "GUI", + "Prefs", + NULL +}; + +void ami_help_init(struct Screen *screen) +{ + AmigaGuideClass = initAGClass(); + + AmigaGuideObject = NewObject(AmigaGuideClass, NULL, + AMIGAGUIDE_Name, "PROGDIR:NetSurf.guide", + AMIGAGUIDE_BaseName, "NetSurf", + AMIGAGUIDE_Screen, screen, + AMIGAGUIDE_ContextArray, context_nodes, + AMIGAGUIDE_ContextID, AMI_HELP_MAIN, + TAG_DONE); +} + +void ami_help_open(ULONG node) +{ + SetAttrs(AmigaGuideObject, AMIGAGUIDE_ContextID, node, TAG_DONE); + IDoMethod(AmigaGuideObject, AGM_OPEN, NULL); +} + +void ami_help_free(void) +{ + if (AmigaGuideObject) DisposeObject(AmigaGuideObject); + if (AmigaGuideClass) freeAGClass(AmigaGuideClass); + + AmigaGuideObject = NULL; + AmigaGuideClass = NULL; +} + +void ami_help_new_screen(struct Screen *screen) +{ + SetAttrs(AmigaGuideObject, AMIGAGUIDE_Screen, screen, TAG_DONE); +} diff --git a/amiga/help.h b/amiga/help.h new file mode 100755 index 000000000..4baa2a0e2 --- /dev/null +++ b/amiga/help.h @@ -0,0 +1,36 @@ +/* + * Copyright 2013 Chris Young + * + * 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 . + */ + +#ifndef AMIGA_HELP_H +#define AMIGA_HELP_H +#include + +/* This enum needs to match context_array in help.c */ +enum { + AMI_HELP_MAIN, + AMI_HELP_GUI, + AMI_HELP_PREFS, +}; + +struct Screen; + +void ami_help_init(struct Screen *screen); +void ami_help_open(ULONG node); +void ami_help_free(void); +void ami_help_new_screen(struct Screen *screen); +#endif -- cgit v1.2.3 From f058e9881764888dc78b4ac32a6dca107bb9b17b Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 24 Jan 2013 20:01:27 +0000 Subject: Added more pages to AmigaGuide doc --- amiga/dist/NetSurf.guide | 106 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 98 insertions(+), 8 deletions(-) diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide index 8759b2b24..e38f9f79a 100755 --- a/amiga/dist/NetSurf.guide +++ b/amiga/dist/NetSurf.guide @@ -7,14 +7,18 @@ http://www.netsurf-browser.org @{" Change Log " link ChangeLog/Main} - @{" Licence " link COPYING/Main} + +@{" GUI " link GUI} +@{" Preferences GUI " link Prefs} + @{" Command line options " link CLI} @{" Options file " link Options} @{" Fonts " link Fonts} @{" ARexx port " link ARexx} @{" OpenURL/URL Prefs " link OpenURL} @{" Hotlist menu " link Hotlist} +@{" Hotlist toolbar " link HotlistToolbar} @{" Local MIME types " link MIMETypes} @{" Keyboard controls " link Keyboard} @@ -23,6 +27,81 @@ http://www.netsurf-browser.org @{" Credits " link Contact} @endnode +@node GUI "Main window" +NetSurf's main GUI consists of a toolbar across the top, an (optional) tab bar, an (optional) hotlist toolbar and the main browser area. It also encompasses a pull-down @{"menu" link Menu}. + +The toolbar buttons are, from left to right: +@{b}Back@{ub} Go back one page in history. Right-clicking gives a menu showing the last ten pages visited. +@{b}Forward@{ub} Go forward one page in history. Right-clicking gives a menu showing up to ten pages available. +@{b}Stop@{ub} Stop loading the page. +@{b}Reload@{ub} Reload the current page. Shift-clicking will reload all elements on the page. +@{b}Home@{ub} Load the home page. + +The gadget to the right of the buttons is the URL bar to type web addresses into. On the far right is the search bar. Typing into here will search for the text using your default search provider (see preferences @{"Advanced tab" link Prefs-Advanced}. + +Below these is the (optional) @{"hotlist toolbar" link HotlistToolbar}. +Below this is the (optional) tab bar. This usually only displays when more than one tab is open, but can be set in @{"preferences" link Prefs-Tabs} to be always present. At the far right is a button to open a new tab. On OS4.0 the current tab can be closed using the button on the far left. On OS4.1 the close gadget for the tab is embedded in the tab itself. + +The rest of the window is taken up with the @{"browser rendering area" link Browser}. This is where the pages visited will be displayed. +@endnode + +@node Browser +@toc GUI +This is the main browser rendering area. + +Drag and drop is supported throughout, so files can be dropped onto text fields, text on pages can be highlighted and dragged to Workbench or text fields. Other elements can be saved by dragging them to Workbench with Ctrl or Shift held down. + +Note that dragging to Workbench only works when NetSurf is running on the Workbench screen. +@endnode + +@node Menu "Menu" +@toc GUI +Project Browser Edit @{"Hotlist" link Hotlist} @{"ARexx" link arexx} + +@endnode + +@node Prefs "Preferences GUI" +@{"General" link Prefs-General} @{"Display" link Prefs-Display} @{"Connection" link Prefs-Connection} @{"Rendering" link Prefs-Rendering} @{"Fonts" link Prefs-Fonts} @{"Cache" link Prefs-Cache} @{"Tabs" link Prefs-Tabs} @{"Advanced" link Prefs-Advanced} @{"Export" link Prefs-Export} +@endnode + +@node Prefs-General "Prefs - General" +@toc Prefs +@endnode + +@node Prefs-Display "Prefs - Display" +@toc Prefs +@endnode + +@node Prefs-Connection "Prefs - Connection" +@toc Prefs +@endnode + +@node Prefs-Rendering "Prefs - Rendering" +@toc Prefs +@endnode + +@node Prefs-Fonts "Prefs - Fonts" +@toc Prefs +See @{"Fonts" link Fonts} +@endnode + +@node Prefs-Cache "Prefs - Cache" +@toc Prefs +@endnode + +@node Prefs-Tabs "Prefs - Tabs" +@toc Prefs +@endnode + +@node Prefs-Advanced "Prefs - Advanced" +@toc Prefs +@endnode + +@node Prefs-Export "Prefs - Export" +@toc Prefs +This section contains options for exporting to PDF. It is not enabled in current builds of NetSurf. +@endnode + @node cli "Command line options" NetSurf URL/K,FORCE/S @@ -44,13 +123,10 @@ There are a couple of Amiga-specific options which can only be changed directly @{b}drag_save_icons@{ub} Enables displaying Workbench-style transparent icons under the pointer when performing drag saves (ctrl-drag of objects available if NetSurf is running on the Workbench screen) and text selection drags. If set to 0 the pointer style will change instead. OS 4.0 users may want to set this to 0 as icons will appear opaque and obscure the drop position. @{b}cairo_renderer@{ub} Set rendering engine. -1 = palette-mapped (set automatically when required), 0 = graphics.library (default), 1 = Cairo/graphics.library mixed, 2 = Full Cairo. @{b}monitor_aspect_x@{ub}/@{b}monitor_aspect_y@{ub} Correct aspect ratio for displays (default of 0 means "assume square pixels"). -@{b}screen_compositing@{ub} Use compositing on NetSurf's own screen. 0=disable, 1=enable, 2=default +@{b}screen_compositing@{ub} Use compositing on NetSurf's own screen. 0=disable, 1=enable, 2=default (NB: This is indirectly modified by changing the "simple refresh" option in the GUI) @{b}redraw_tile_size_x@{ub}/@{b}redraw_tile_size_y@{ub} Specify the size of the off-screen bitmap. Higher will speed up redraws at the expense of memory. 0 disables tiling (will use a bitmap at least the size of the screen NetSurf is running on) -@{b}font_antialiasing@{ub} Switch text anti-aliasing on or off. Defaults to on in true-colour modes, but text rendering performance can be improved by setting to 0. -@{b}window_simple_refresh@{ub} If set to 1, NetSurf will use SimpleRefresh rather than SmartRefresh windows. These have slower redraw but use less memory. Note that this setting has no noticeable effect if compositing is enabled. Defaults to 0 (SmartRefresh) @{b}web_search_width@{ub} Defaults to 0. Larger values will increase the size of the web search gadget next to the URL bar. -@{b}dithering_quality@{ub} Specify the dithering quality from all values supported by picture.datatype. Currently these are 0=None, 1=Normal, 2=High quality. Other values are undefined. This is only used when NetSurf is running in palette-mapped mode. @{b}mask_alpha@{ub} Threshold to use when determining which alpha values to convert to full transparency (0 - 255, where 255 will convert even opaque pixels to transparent). Defaults to 50 (0x32). This is only used in palette-mapped modes where alpha blending is not currently supported. @{b}url_file@{ub} Path to URL database file @@ -61,7 +137,7 @@ There are a couple of Amiga-specific options which can only be changed directly @endnode @node Fonts -The font to use for each font type can be defined in NetSurf's options. OS4 NetSurf supports soft styles for bold and italic, however designed fonts look better and it is highly recommend to set them as follows: +The font to use for each font type can be defined in NetSurf's options. OS4 NetSurf supports soft styles for bold and italic, however designed fonts look better and it is highly recommended to set them as follows: Within @{"TypeManager" system "SYS:System/TypeManager"} select a font being used by NetSurf and click on Modify. On the Files tab, Font family section, choose the @{b}bold@{ub}, @{i}italic@{ui} and @{b}@{i}bold-italic@{ui}@{ub} version of the font. @@ -194,7 +270,7 @@ Folders with no items in them will show up disabled in the menu. If they are na eg. -- Menu +- Hotlist Menu | +- Netsurf | | @@ -216,6 +292,20 @@ Will look something like the following within the menu: @endnode +@node HotlistToolbar "Hotlist toolbar" +A toolbar for frequently-accessed sites can be added to the main window. To do show, follow these steps: + +* Select Show Hotlist from the Hotlist menu +The Hotlist window will be displayed. + +* Locate the "Hotlist toolbar" folder in the tree (NetSurf creates this when it starts up) + +* Move or create entries in this folder. Any entries directly inside the Hotlist toolbar folder will appear on the toolbar when the hotlist window is closed. If it is empty the toolbar will disappear to save space. + +Note that sub-folders are not currently supported on the toolbar. + +@endnode + @node mimetypes "Local MIME Types" NetSurf determines the MIME types of local files primarily by checking the icon of the file. If the icon is not found it will check the default icon for the file type. @@ -294,5 +384,5 @@ The default theme icon was adapted from the NetSurf logo by Marko K. Sepp All other code and files are the same for all platforms and credited in the files and/or on the NetSurf website. http://www.netsurf-browser.org -The source code can be obtained from http://www.netsurf-browser.org SVN or (in the event the service is unavailable) chris@unsatisfactorysoftware.co.uk or any other of the NetSurf developers. +The source code can be obtained from http://source.netsurf-browser.org or (in the event the service is unavailable) chris@unsatisfactorysoftware.co.uk or any other of the NetSurf developers. @endnode -- cgit v1.2.3 From 12890d3c60fdfde9c3f18af411a762ff1e0e27c2 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 24 Jan 2013 20:08:59 +0000 Subject: Attempt fix screen close problem --- amiga/gui.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index e544dbd60..9352fcec1 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2371,11 +2371,13 @@ void ami_quit_netsurf_delayed(void) } } -void ami_gui_close_screen(struct Screen *scrn) +void ami_gui_close_screen(struct Screen *scrn, BOOL locked_screen) { if(scrn == NULL) return; if(CloseScreen(scrn)) return; + if(locked_screen == TRUE) return; + /* If this is our own screen, wait for visitor windows to close */ LOG(("Waiting for visitor windows to close...")); do { Delay(50); @@ -2404,10 +2406,7 @@ void gui_quit(void) FreeScreenDrawInfo(scrn, dri); ami_close_fonts(); - - /* If it is our public screen, close it or wait until the visitor windows leave */ - if(locked_screen == FALSE) ami_gui_close_screen(scrn); - + ami_gui_close_screen(scrn, locked_screen); FreeVec(nsscreentitle); ami_context_menu_free(); -- cgit v1.2.3 From 30dfa090085f9b0b21ea5181795e9f6930292897 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 24 Jan 2013 20:16:35 +0000 Subject: Disable help for now, as it causes the popupmenu.class deadlock again --- amiga/gui.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 9352fcec1..2c1a78ac7 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -386,7 +386,7 @@ void ami_open_resources(void) TAG_DONE))) die(messages_get("NoMemory")); ami_file_req_init(); - ami_help_init(NULL); +// ami_help_init(NULL); } void ami_set_options(void) @@ -669,7 +669,7 @@ void ami_openscreen(void) gui_system_colour_finalize(); gui_system_colour_init(); - ami_help_new_screen(scrn); +// ami_help_new_screen(scrn); } void ami_openscreenfirst(void) @@ -1830,7 +1830,7 @@ void ami_handle_msg(void) break; case RAWKEY_HELP: // help - ami_help_open(AMI_HELP_GUI); + //ami_help_open(AMI_HELP_GUI); break; } } @@ -2418,7 +2418,7 @@ void gui_quit(void) FreeSysObject(ASOT_PORT,appport); FreeSysObject(ASOT_PORT,sport); - ami_help_free(); +// ami_help_free(); ami_file_req_free(); ami_openurl_close(); -- cgit v1.2.3 From 23e16e020e40807d1e7e099d06af9b56cb426149 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sat, 26 Jan 2013 22:04:26 +0000 Subject: Initialise return values in error cases, too: core code is horrifically lax at checking errors from these APIs. --- riscos/font.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/riscos/font.c b/riscos/font.c index 326cca973..8d4c6d337 100644 --- a/riscos/font.c +++ b/riscos/font.c @@ -255,6 +255,7 @@ bool nsfont_width(const plot_font_style_t *fstyle, else LOG(("rufl_width: 0x%x", code)); /* warn_user("MiscError", "font error"); */ + *width = 0; return false; } @@ -303,6 +304,8 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle, else LOG(("rufl_x_to_offset: 0x%x", code)); /* warn_user("MiscError", "font error"); */ + *char_offset = 0; + *actual_x = 0; return false; } @@ -355,6 +358,8 @@ bool nsfont_split(const plot_font_style_t *fstyle, else LOG(("rufl_split: 0x%x", code)); /* warn_user("MiscError", "font error"); */ + *char_offset = 0; + *actual_x = 0; return false; } @@ -386,6 +391,8 @@ bool nsfont_split(const plot_font_style_t *fstyle, else LOG(("rufl_width: 0x%x", code)); /* warn_user("MiscError", "font error"); */ + *char_offset = 0; + *actual_x = 0; return false; } -- cgit v1.2.3 From a30d51cb50f130bc91c7ee13b6656f1e64c94215 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 27 Jan 2013 11:09:54 +0000 Subject: Ensure we free the same size raster that we allocated --- amiga/gui.c | 6 +++--- amiga/theme.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 2c1a78ac7..c9645835a 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -386,7 +386,7 @@ void ami_open_resources(void) TAG_DONE))) die(messages_get("NoMemory")); ami_file_req_init(); -// ami_help_init(NULL); + //ami_help_init(NULL); } void ami_set_options(void) @@ -669,7 +669,7 @@ void ami_openscreen(void) gui_system_colour_finalize(); gui_system_colour_init(); -// ami_help_new_screen(scrn); + //ami_help_new_screen(scrn); } void ami_openscreenfirst(void) @@ -2418,7 +2418,7 @@ void gui_quit(void) FreeSysObject(ASOT_PORT,appport); FreeSysObject(ASOT_PORT,sport); -// ami_help_free(); + //ami_help_free(); ami_file_req_free(); ami_openurl_close(); diff --git a/amiga/theme.c b/amiga/theme.c index 65d2f51e1..d0808a4a2 100644 --- a/amiga/theme.c +++ b/amiga/theme.c @@ -370,8 +370,8 @@ void ami_mouse_pointers_free(void) { if(mouseptrbm[i]) { - FreeRaster(mouseptrbm[i]->Planes[0],16,16); - FreeRaster(mouseptrbm[i]->Planes[1],16,16); + FreeRaster(mouseptrbm[i]->Planes[0],32,32); + FreeRaster(mouseptrbm[i]->Planes[1],32,32); FreeVec(mouseptrbm[i]); } } -- cgit v1.2.3 From 7710214ec2306f2faa7fa2300b4972f5f0151127 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 27 Jan 2013 23:09:26 +0000 Subject: Remove p96EncodeColour and ensure the alpha byte is set to 0xff. --- amiga/plotters.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/amiga/plotters.c b/amiga/plotters.c index 7347f064d..595ec0d14 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -1,5 +1,5 @@ /* - * Copyright 2008, 2009, 2012 Chris Young + * Copyright 2008-09, 2012-13 Chris Young * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -101,6 +101,18 @@ const struct plotter_table amiplot = { .option_knockout = true, }; +colour ami_abgr_to_argb(colour c) { + colour argb = 0x00000000; + + /* NB: We force the alpha byte to be 0xff, as it is not set by the core. */ + argb = 0xff000000 | + ((c & 0x00ff0000) >> 16) | + (c & 0x0000ff00) | + ((c & 0x000000ff) << 16); + + return argb; +} + #ifdef NS_AMIGA_CAIRO void ami_cairo_set_colour(cairo_t *cr,colour c) { @@ -285,7 +297,7 @@ static void ami_plot_setapen(ULONG colour) { if(palette_mapped == false) { SetRPAttrs(glob->rp, RPTAG_APenColor, - p96EncodeColor(RGBFB_A8B8G8R8, colour), + ami_abgr_to_argb(colour), TAG_DONE); } else { ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour); @@ -297,7 +309,7 @@ static void ami_plot_setopen(ULONG colour) { if(palette_mapped == false) { SetRPAttrs(glob->rp, RPTAG_OPenColor, - p96EncodeColor(RGBFB_A8B8G8R8, colour), + ami_abgr_to_argb(colour), TAG_DONE); } else { ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour); -- cgit v1.2.3 From 75a24f7838896910db7d0fa549d6101d9ad65719 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 29 Jan 2013 14:07:24 +0000 Subject: Add enum value for when no button is pressed (hover). --- desktop/mouse.h | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/desktop/mouse.h b/desktop/mouse.h index 42603a67a..042db23a9 100644 --- a/desktop/mouse.h +++ b/desktop/mouse.h @@ -28,8 +28,12 @@ /* Mouse state. 1 is primary mouse button (e.g. Select on RISC OS). * 2 is secondary mouse button (e.g. Adjust on RISC OS). */ typedef enum { - BROWSER_MOUSE_PRESS_1 = 1, /* button 1 pressed */ - BROWSER_MOUSE_PRESS_2 = 2, /* button 2 pressed */ + BROWSER_MOUSE_HOVER = 0, /* No mouse buttons pressed, + * May be used to indicate + * hover or end of drag. */ + + BROWSER_MOUSE_PRESS_1 = (1 << 0), /* button 1 pressed */ + BROWSER_MOUSE_PRESS_2 = (1 << 1), /* button 2 pressed */ /* note: click meaning is different for * different front ends. On RISC OS, it @@ -40,27 +44,29 @@ typedef enum { * click is fired when the mouse button * is released, if the operation wasn't * a drag. */ - BROWSER_MOUSE_CLICK_1 = 4, /* button 1 clicked. */ - BROWSER_MOUSE_CLICK_2 = 8, /* button 2 clicked. */ - BROWSER_MOUSE_DOUBLE_CLICK = 16, /* button 1 double clicked */ + BROWSER_MOUSE_CLICK_1 = (1 << 2), /* button 1 clicked. */ + BROWSER_MOUSE_CLICK_2 = (1 << 3), /* button 2 clicked. */ + + BROWSER_MOUSE_DOUBLE_CLICK = (1 << 4), /* button 1 double clicked */ - BROWSER_MOUSE_DRAG_1 = 32, /* start of button 1 drag operation */ - BROWSER_MOUSE_DRAG_2 = 64, /* start of button 2 drag operation */ + BROWSER_MOUSE_DRAG_1 = (1 << 5), /* start of button 1 drag */ + BROWSER_MOUSE_DRAG_2 = (1 << 6), /* start of button 2 drag */ - BROWSER_MOUSE_DRAG_ON = 128, /* a drag operation was started and - * a mouse button is still pressed */ + BROWSER_MOUSE_DRAG_ON = (1 << 7), /* a drag operation was started + * and a mouse button is still + * pressed */ - BROWSER_MOUSE_HOLDING_1 = 256, /* while button 1 drag is in progress */ - BROWSER_MOUSE_HOLDING_2 = 512, /* while button 2 drag is in progress */ + BROWSER_MOUSE_HOLDING_1 = (1 << 8), /* during button 1 drag */ + BROWSER_MOUSE_HOLDING_2 = (1 << 9), /* during button 2 drag */ - BROWSER_MOUSE_MOD_1 = 1024, /* primary modifier key pressed - * (eg. Shift) */ - BROWSER_MOUSE_MOD_2 = 2048, /* secondary modifier key pressed - * (eg. Ctrl) */ - BROWSER_MOUSE_MOD_3 = 4096 /* secondary modifier key pressed - * (eg. Alt) */ + BROWSER_MOUSE_MOD_1 = (1 << 10), /* 1st modifier key pressed + * (eg. Shift) */ + BROWSER_MOUSE_MOD_2 = (1 << 11), /* 2nd modifier key pressed + * (eg. Ctrl) */ + BROWSER_MOUSE_MOD_3 = (1 << 12) /* 3rd modifier key pressed + * (eg. Alt) */ } browser_mouse_state; -- cgit v1.2.3 From 93cc123200f1e4856ad5b5c608d8deeb34522053 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 29 Jan 2013 17:34:08 +0000 Subject: Update textarea to inform client what it's doing with drags. Now single callback for both redraw requests and drag reports. Update treeview to use new textarea API. Update Atari URL bar to use new textarea API. (Ignores drag reports, currently.) Minor textarea fixes. --- atari/toolbar.c | 23 ++++- desktop/textarea.c | 254 +++++++++++++++++++++++++++++++++++++---------------- desktop/textarea.h | 52 +++++++---- desktop/tree.c | 93 +++++++++++--------- 4 files changed, 282 insertions(+), 140 deletions(-) diff --git a/atari/toolbar.c b/atari/toolbar.c index 82dc047fa..d30382842 100755 --- a/atari/toolbar.c +++ b/atari/toolbar.c @@ -651,7 +651,26 @@ static void tb_txt_request_redraw(void *data, int x, int y, int w, int h) t->url.rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - t->url.rdw_area.g_y : newy1 - t->url.rdw_area.g_y; } -} +} + + +static void tb_txt_callback(void *data, struct textarea_msg *msg) +{ + switch (msg->type) { + case TEXTAREA_MSG_DRAG_REPORT: + break; + + case TEXTAREA_MSG_REDRAW_REQUEST: + tb_txt_redraw_request(data, + msg->data.redraw.x0, msg->data.redraw.y0, + msg->data.redraw.x1 - msg->data.redraw.x0, + msg->data.redraw.y1 - msg->data.redraw.y0); + break; + + default: + break; + } +} void tb_url_redraw( struct gui_window * gw ) { @@ -785,7 +804,7 @@ CMP_TOOLBAR tb_create( struct gui_window * gw ) ta_setup.text = font_style_url; ta_setup.text.foreground = 0x000000; ta_setup.text.background = 0xffffff; - t->url.textarea = textarea_create( &ta_setup, tb_txt_request_redraw, t ); + t->url.textarea = textarea_create( &ta_setup, tb_txt_callback, t ); if( t->url.textarea != NULL ){ textarea_set_text(t->url.textarea, "http://"); } diff --git a/desktop/textarea.c b/desktop/textarea.c index e94360e5b..725c911b7 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -43,18 +43,14 @@ static plot_style_t pstyle_stroke_caret = { .stroke_width = 1, }; +static struct textarea_msg msg; + struct line_info { unsigned int b_start; /**< Byte offset of line start */ unsigned int b_length; /**< Byte length of line */ }; - -typedef enum textarea_drag_type_internal { - TEXTAREA_DRAG_NONE, - TEXTAREA_DRAG_SCROLLBAR, - TEXTAREA_DRAG_SELECTION -} textarea_drag_type_internal; struct textarea_drag { - textarea_drag_type_internal type; + textarea_drag_type type; union { struct scrollbar* scrollbar; } data; @@ -106,7 +102,7 @@ struct textarea { int line_height; /**< Line height obtained from style */ /** Callback function for a redraw request */ - textarea_redraw_request_callback redraw_request; + textarea_client_callback callback; void *data; /**< Client data for callback */ @@ -179,7 +175,14 @@ static bool textarea_select(struct textarea *ta, int c_start, int c_end) ta->sel_start = c_start; ta->sel_end = c_end; - ta->redraw_request(ta->data, 0, 0, ta->vis_width, ta->vis_height); + msg.ta = ta; + msg.type = TEXTAREA_MSG_REDRAW_REQUEST; + msg.data.redraw.x0 = 0; + msg.data.redraw.y0 = 0; + msg.data.redraw.x1 = ta->vis_width; + msg.data.redraw.y1 = ta->vis_height; + + ta->callback(ta->data, &msg); return true; } @@ -322,6 +325,7 @@ static bool textarea_scroll_visible(struct textarea *ta) return scrolled; } + /** * Callback for scrollbar widget. */ @@ -331,27 +335,46 @@ static void textarea_scrollbar_callback(void *client_data, struct textarea *ta = client_data; switch(scrollbar_data->msg) { - case SCROLLBAR_MSG_MOVED: - /* Scrolled; redraw everything */ - ta->scroll_x = scrollbar_get_offset(ta->bar_x); - ta->scroll_y = scrollbar_get_offset(ta->bar_y); + case SCROLLBAR_MSG_MOVED: + /* Scrolled; redraw everything */ + ta->scroll_x = scrollbar_get_offset(ta->bar_x); + ta->scroll_y = scrollbar_get_offset(ta->bar_y); + + msg.ta = ta; + msg.type = TEXTAREA_MSG_REDRAW_REQUEST; + msg.data.redraw.x0 = 0; + msg.data.redraw.y0 = 0; + msg.data.redraw.x1 = ta->vis_width; + msg.data.redraw.y1 = ta->vis_height; + + ta->callback(ta->data, &msg); + break; - ta->redraw_request(ta->data, 0, 0, - ta->vis_width, - ta->vis_height); - break; + case SCROLLBAR_MSG_SCROLL_START: + ta->drag_info.type = TEXTAREA_DRAG_SCROLLBAR; + ta->drag_info.data.scrollbar = scrollbar_data->scrollbar; - case SCROLLBAR_MSG_SCROLL_START: - ta->drag_info.type = TEXTAREA_DRAG_SCROLLBAR; - ta->drag_info.data.scrollbar = - scrollbar_data->scrollbar; - /* TODO: Tell textarea client we're handling a drag */ - break; + msg.ta = ta; + msg.type = TEXTAREA_MSG_DRAG_REPORT; + msg.data.drag = ta->drag_info.type; - case SCROLLBAR_MSG_SCROLL_FINISHED: - ta->drag_info.type = TEXTAREA_DRAG_NONE; - /* TODO: Tell textarea client drag finished */ - break; + /* Tell client we're handling a drag */ + ta->callback(ta->data, &msg); + break; + + case SCROLLBAR_MSG_SCROLL_FINISHED: + ta->drag_info.type = TEXTAREA_DRAG_NONE; + + msg.ta = ta; + msg.type = TEXTAREA_MSG_DRAG_REPORT; + msg.data.drag = ta->drag_info.type; + + /* Tell client we finished handling the drag */ + ta->callback(ta->data, &msg); + break; + + default: + break; } } @@ -799,15 +822,79 @@ static bool textarea_replace_text(struct textarea *ta, unsigned int start, } +/** + * Handles the end of a drag operation + * + * \param ta Text area + * \param mouse the mouse state at drag end moment + * \param x X coordinate + * \param y Y coordinate + * \return true if drag end was handled false otherwise + */ +static bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse, + int x, int y) +{ + int c_end; + size_t b_off; + unsigned int c_off; + + assert(ta->drag_info.type != TEXTAREA_DRAG_NONE); + + switch (ta->drag_info.type) { + case TEXTAREA_DRAG_SCROLLBAR: + if (ta->drag_info.data.scrollbar == ta->bar_x) { + x -= ta->border_width; + y -= ta->vis_height - ta->border_width - + SCROLLBAR_WIDTH; + } else { + x -= ta->vis_width - ta->border_width - + SCROLLBAR_WIDTH; + y -= ta->border_width; + } + scrollbar_mouse_drag_end(ta->drag_info.data.scrollbar, + mouse, x, y); + assert(ta->drag_info.type == TEXTAREA_DRAG_NONE); + + /* Return, since drag end already reported to textarea client */ + return true; + + case TEXTAREA_DRAG_SELECTION: + ta->drag_info.type = TEXTAREA_DRAG_NONE; + + textarea_get_xy_offset(ta, x, y, &b_off, &c_off); + c_end = c_off; + + if (!textarea_select(ta, ta->drag_start_char, c_end)) + return false; + + break; + + default: + return false; + } + + /* Report drag end to client, if not already reported */ + assert(ta->drag_info.type == TEXTAREA_DRAG_NONE); + + msg.ta = ta; + msg.type = TEXTAREA_MSG_DRAG_REPORT; + msg.data.drag = ta->drag_info.type; + + ta->callback(ta->data, &msg); + + return true; +} + + /* exported interface, documented in textarea.h */ struct textarea *textarea_create(const textarea_setup *setup, - textarea_redraw_request_callback redraw_request, void *data) + textarea_client_callback callback, void *data) { struct textarea *ret; - if (redraw_request == NULL) { + if (callback == NULL) { LOG(("no callback provided")); return NULL; } @@ -818,7 +905,7 @@ struct textarea *textarea_create(const textarea_setup *setup, return NULL; } - ret->redraw_request = redraw_request; + ret->callback = callback; ret->data = data; ret->flags = setup->flags; @@ -972,7 +1059,14 @@ bool textarea_set_caret(struct textarea *ta, int caret) width = 2; height = ta->line_height; - ta->redraw_request(ta->data, x0, y0, width, height); + msg.ta = ta; + msg.type = TEXTAREA_MSG_REDRAW_REQUEST; + msg.data.redraw.x0 = x0; + msg.data.redraw.y0 = y0; + msg.data.redraw.x1 = x0 + width; + msg.data.redraw.y1 = y0 + height; + + ta->callback(ta->data, &msg); } /* check if the caret has to be drawn at all */ @@ -1032,8 +1126,14 @@ bool textarea_set_caret(struct textarea *ta, int caret) height = y1 - y0; if (width > 0 && height > 0) { - ta->redraw_request(ta->data, x0, y0, - width, height); + msg.ta = ta; + msg.type = TEXTAREA_MSG_REDRAW_REQUEST; + msg.data.redraw.x0 = x0; + msg.data.redraw.y0 = y0; + msg.data.redraw.x1 = x0 + width; + msg.data.redraw.y1 = y0 + height; + + ta->callback(ta->data, &msg); } } } @@ -1147,8 +1247,7 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, (ta->bar_x != NULL ? SCROLLBAR_WIDTH : 0); if (line0 > 0) - c_pos = utf8_bounded_length(ta->text, - ta->lines[line0].b_start - 1); + c_pos = utf8_bounded_length(ta->text, ta->lines[line0].b_start); else c_pos = 0; @@ -1683,8 +1782,14 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) textarea_set_caret(ta, caret); //TODO:redraw only the important part if (redraw) { - ta->redraw_request(ta->data, 0, 0, - ta->vis_width, ta->vis_height); + msg.ta = ta; + msg.type = TEXTAREA_MSG_REDRAW_REQUEST; + msg.data.redraw.x0 = 0; + msg.data.redraw.y0 = 0; + msg.data.redraw.x1 = ta->vis_width; + msg.data.redraw.y1 = ta->vis_height; + + ta->callback(ta->data, &msg); } return true; @@ -1701,7 +1806,14 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, size_t b_off; unsigned int c_off; + if (ta->drag_info.type != TEXTAREA_DRAG_NONE && + mouse == BROWSER_MOUSE_HOVER) { + /* There is a drag that we must end */ + textarea_drag_end(ta, mouse, x, y); + } + if (ta->drag_info.type == TEXTAREA_DRAG_SCROLLBAR) { + /* Scrollbar drag in progress; pass input to scrollbar */ if (ta->drag_info.data.scrollbar == ta->bar_x) { x -= ta->border_width; y -= ta->vis_height - ta->border_width - @@ -1718,6 +1830,8 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, /* Horizontal scrollbar */ if (ta->bar_x != NULL && ta->drag_info.type == TEXTAREA_DRAG_NONE) { + /* No drag happening, but mouse input is over scrollbar; + * pass input to scrollbar */ sx = x - ta->border_width; sy = y - (ta->vis_height - ta->border_width - SCROLLBAR_WIDTH); sl = ta->vis_width - 2 * ta->border_width - @@ -1731,6 +1845,8 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, /* Vertical scrollbar */ if (ta->bar_y != NULL && ta->drag_info.type == TEXTAREA_DRAG_NONE) { + /* No drag happening, but mouse input is over scrollbar; + * pass input to scrollbar */ sx = x - (ta->vis_width - ta->border_width - SCROLLBAR_WIDTH); sy = y - ta->border_width; sl = ta->vis_height - 2 * ta->border_width; @@ -1752,9 +1868,15 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, if (ta->sel_start != -1) { /* remove selection */ ta->sel_start = ta->sel_end = -1; - ta->redraw_request(ta->data, 0, 0, - ta->vis_width, - ta->vis_height); + + msg.ta = ta; + msg.type = TEXTAREA_MSG_REDRAW_REQUEST; + msg.data.redraw.x0 = 0; + msg.data.redraw.y0 = 0; + msg.data.redraw.x1 = ta->vis_width; + msg.data.redraw.y1 = ta->vis_height; + + ta->callback(ta->data, &msg); } } else if (mouse & BROWSER_MOUSE_DOUBLE_CLICK) { @@ -1768,47 +1890,17 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, c_start = ta->drag_start_char; c_end = c_off; ta->drag_info.type = TEXTAREA_DRAG_SELECTION; - return textarea_select(ta, c_start, c_end); - } - - return true; -} - - -/* exported interface, documented in textarea.h */ -bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse, - int x, int y) -{ - int c_end; - size_t b_off; - unsigned int c_off; - switch (ta->drag_info.type) { - case TEXTAREA_DRAG_SCROLLBAR: - if (ta->drag_info.data.scrollbar == ta->bar_x) { - x -= ta->border_width; - y -= ta->vis_height - ta->border_width - - SCROLLBAR_WIDTH; - } else { - x -= ta->vis_width - ta->border_width - - SCROLLBAR_WIDTH; - y -= ta->border_width; - } - scrollbar_mouse_drag_end(ta->drag_info.data.scrollbar, - mouse, x, y); - return true; + msg.ta = ta; + msg.type = TEXTAREA_MSG_DRAG_REPORT; + msg.data.drag = ta->drag_info.type; - case TEXTAREA_DRAG_SELECTION: - textarea_get_xy_offset(ta, x, y, &b_off, &c_off); - c_end = c_off; - ta->drag_info.type = TEXTAREA_DRAG_NONE; - return textarea_select(ta, ta->drag_start_char, c_end); + ta->callback(ta->data, &msg); - default: - break; + return textarea_select(ta, c_start, c_end); } - return false; + return true; } @@ -1828,5 +1920,13 @@ void textarea_set_dimensions(struct textarea *ta, int width, int height) ta->vis_width = width; ta->vis_height = height; textarea_reflow(ta, 0); - ta->redraw_request(ta->data, 0, 0, ta->vis_width, ta->vis_height); + + msg.ta = ta; + msg.type = TEXTAREA_MSG_REDRAW_REQUEST; + msg.data.redraw.x0 = 0; + msg.data.redraw.y0 = 0; + msg.data.redraw.x1 = ta->vis_width; + msg.data.redraw.y1 = ta->vis_height; + + ta->callback(ta->data, &msg); } diff --git a/desktop/textarea.h b/desktop/textarea.h index 7624c3187..fb8b13425 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -29,13 +29,37 @@ #include "desktop/browser.h" #include "desktop/plot_style.h" + +struct textarea; + /* Text area flags */ -typedef enum textarea_flags { +typedef enum { TEXTAREA_DEFAULT = (1 << 0), TEXTAREA_MULTILINE = (1 << 1), TEXTAREA_READONLY = (1 << 2) } textarea_flags; +typedef enum { + TEXTAREA_DRAG_NONE, + TEXTAREA_DRAG_SCROLLBAR, + TEXTAREA_DRAG_SELECTION +} textarea_drag_type; + +typedef enum { + TEXTAREA_MSG_DRAG_REPORT, /**< Textarea drag start/end report */ + TEXTAREA_MSG_REDRAW_REQUEST /**< Textarea redraw request */ +} textarea_msg_type; + +struct textarea_msg { + struct textarea *ta; + + textarea_msg_type type; + union { + textarea_drag_type drag; + struct rect redraw; + } data; +}; + typedef struct textarea_setup { textarea_flags flags; /**< Setup flags */ @@ -56,11 +80,13 @@ typedef struct textarea_setup { } textarea_setup; - -struct textarea; - -typedef void(*textarea_redraw_request_callback)(void *data, int x, int y, - int width, int height); +/** + * Client callback for the textarea + * + * \param data user data passed at textarea creation + * \param textarea_msg textarea message data + */ +typedef void(*textarea_client_callback)(void *data, struct textarea_msg *msg); /** * Create a text area @@ -71,7 +97,7 @@ typedef void(*textarea_redraw_request_callback)(void *data, int x, int y, * \return Opaque handle for textarea or 0 on error */ struct textarea *textarea_create(const textarea_setup *setup, - textarea_redraw_request_callback redraw_request, void *data); + textarea_client_callback callback, void *data); /** * Destroy a text area @@ -152,18 +178,6 @@ bool textarea_keypress(struct textarea *ta, uint32_t key); bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, int x, int y); -/** - * Handles the end of a drag operation - * - * \param ta Text area - * \param mouse the mouse state at drag end moment - * \param x X coordinate - * \param y Y coordinate - * \return true if drag end was handled false otherwise - */ -bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse, - int x, int y); - /** * Gets the dimensions of a textarea * diff --git a/desktop/tree.c b/desktop/tree.c index a48b615a0..4f9170d06 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -160,8 +160,7 @@ struct tree { int height; /* Tree height */ unsigned int flags; /* Tree flags */ struct textarea *textarea; /* Handle for UTF-8 textarea */ - bool textarea_drag_start; /* whether the start of a mouse drag - was in the textarea */ + int ta_height; /* Textarea height */ struct node_element *editing; /* Node element being edited */ bool redraw; /* Flag indicating whether the tree @@ -263,7 +262,6 @@ struct tree *tree_create(unsigned int flags, tree->height = 0; tree->flags = flags; tree->textarea = NULL; - tree->textarea_drag_start = false; tree->editing = NULL; tree->redraw = false; tree->drag = TREE_NO_DRAG; @@ -2430,9 +2428,9 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x, x0 += NODE_INSTEP; x1 = tree->editing->box.x + tree->editing->box.width; y0 = tree->editing->box.y; - y1 = tree->editing->box.y + tree->editing->box.height; + y1 = tree->editing->box.y + tree->ta_height; - if (tree->textarea_drag_start && + if (tree->drag == TREE_TEXTAREA_DRAG && (mouse & (BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_HOLDING_2))) { /* Track the drag path */ @@ -2441,19 +2439,7 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x, return true; } - - if ((x >= x0) && (x < x1) && (y >= y0) && (y < y1)) { - /* Inside the textarea */ - if (mouse & (BROWSER_MOUSE_DRAG_1 | - BROWSER_MOUSE_DRAG_2)) { - /* Drag starting */ - tree->textarea_drag_start = true; - tree->drag = TREE_TEXTAREA_DRAG; - } else { - /* Other action */ - tree->textarea_drag_start = false; - } textarea_mouse_action(tree->textarea, mouse, x - x0, y - y0); return true; @@ -2461,8 +2447,6 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x, } } - tree->textarea_drag_start = false; - /* we are not interested in the drag path, return */ if (mouse & (BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_HOLDING_2)) return true; @@ -2835,25 +2819,25 @@ void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0, struct node *node; int x, y; - if (tree->textarea_drag_start) { + switch (tree->drag) { + case TREE_NO_DRAG: + case TREE_UNKNOWN_DRAG: + break; + + case TREE_TEXTAREA_DRAG: x = tree->editing->box.x; y = tree->editing->box.y; if (tree->editing->type == NODE_ELEMENT_TEXT_PLUS_ICON) x += NODE_INSTEP; - textarea_drag_end(tree->textarea, mouse, x1 - x, y1 - y); - } - - tree->textarea_drag_start = false; - - switch (tree->drag) { - case TREE_NO_DRAG: - case TREE_TEXTAREA_DRAG: - case TREE_UNKNOWN_DRAG: + textarea_mouse_action(tree->textarea, BROWSER_MOUSE_HOVER, + x1 - x, y1 - y); break; + case TREE_SELECT_DRAG: tree_handle_selection_area(tree, y0, y1 - y0, (mouse | BROWSER_MOUSE_HOLDING_2)); break; + case TREE_MOVE_DRAG: if (!(tree->flags & TREE_MOVABLE)) return; @@ -2875,7 +2859,6 @@ void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0, */ bool tree_keypress(struct tree *tree, uint32_t key) { - if (tree->editing != NULL) switch (key) { case KEY_ESCAPE: @@ -2912,19 +2895,43 @@ int tree_alphabetical_sort(struct node *n1, struct node *n2) * check the redraw flag of the tree before requesting a redraw and change the * position to tree origin relative. */ -static void tree_textarea_redraw_request(void *data, int x, int y, - int width, int height) + +static void tree_textarea_callback(void *data, struct textarea_msg *msg) { struct tree *tree = data; - x = x + tree->editing->box.x; - y = y + tree->editing->box.y; - if (tree->editing->type == NODE_ELEMENT_TEXT_PLUS_ICON) - x += NODE_INSTEP; + int x, y; - if (tree->redraw) - tree->callbacks->redraw_request(x, y, - width, height, - tree->client_data); + switch (msg->type) { + case TEXTAREA_MSG_DRAG_REPORT: + if (msg->data.drag == TEXTAREA_DRAG_NONE) { + /* Textarea drag finished */ + tree->drag = TREE_NO_DRAG; + } else { + /* Textarea drag started */ + tree->drag = TREE_TEXTAREA_DRAG; + } + break; + + case TEXTAREA_MSG_REDRAW_REQUEST: + x = msg->data.redraw.x0 + tree->editing->box.x; + y = msg->data.redraw.y0 + tree->editing->box.y; + + if (tree->editing->type == NODE_ELEMENT_TEXT_PLUS_ICON) + x += NODE_INSTEP; + + /* Redraw the textarea */ + if (tree->redraw) + tree->callbacks->redraw_request(x, y, + msg->data.redraw.x1 - + msg->data.redraw.x0, + msg->data.redraw.y1 - + msg->data.redraw.y0, + tree->client_data); + break; + + default: + break; + } } @@ -2963,9 +2970,11 @@ void tree_start_edit(struct tree *tree, struct node_element *element) if (element->type == NODE_ELEMENT_TEXT_PLUS_ICON) width -= NODE_INSTEP; + tree->ta_height = height; + ta_setup.flags = TEXTAREA_DEFAULT; ta_setup.width = width; - ta_setup.height = height; + ta_setup.height = tree->ta_height; ta_setup.pad_top = 0; ta_setup.pad_right = 4; ta_setup.pad_bottom = 0; @@ -2979,7 +2988,7 @@ void tree_start_edit(struct tree *tree, struct node_element *element) ta_setup.text.background = 0xffffff; tree->textarea = textarea_create(&ta_setup, - tree_textarea_redraw_request, tree); + tree_textarea_callback, tree); if (tree->textarea == NULL) { tree_stop_edit(tree, false); return; -- cgit v1.2.3 From 385d9170d993f67c40b9ec2b69dab45e7bd96027 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 29 Jan 2013 17:46:05 +0000 Subject: Replace textarea_drag_end call with textarea_mouse_action. s/redraw_request/request_redraw/ --- atari/toolbar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atari/toolbar.c b/atari/toolbar.c index d30382842..d4feaabfb 100755 --- a/atari/toolbar.c +++ b/atari/toolbar.c @@ -564,7 +564,7 @@ void __CDECL evnt_url_click( COMPONENT *c, long buff[8] ) mx = mx - (work.g_x + TOOLBAR_URL_MARGIN_LEFT); my = my - (work.g_y + TOOLBAR_URL_MARGIN_TOP); }while( mb & 1 ); - textarea_drag_end( tb->url.textarea, 0, mx, my ); + textarea_mouse_action( tb->url.textarea, BROWSER_MOUSE_HOVER, mx, my ); } else { /* TODO: recognize click + shift key */ int mstate = BROWSER_MOUSE_PRESS_1; @@ -661,7 +661,7 @@ static void tb_txt_callback(void *data, struct textarea_msg *msg) break; case TEXTAREA_MSG_REDRAW_REQUEST: - tb_txt_redraw_request(data, + tb_txt_request_redraw(data, msg->data.redraw.x0, msg->data.redraw.y0, msg->data.redraw.x1 - msg->data.redraw.x0, msg->data.redraw.y1 - msg->data.redraw.y0); -- cgit v1.2.3 From af7a5d2d67a2eb42e67a1775ba4a83d9b5ce6939 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 29 Jan 2013 20:28:10 +0000 Subject: Don't redraw if selection is unchanged. --- desktop/textarea.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/desktop/textarea.c b/desktop/textarea.c index 725c911b7..872c6382b 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -172,6 +172,9 @@ static bool textarea_select(struct textarea *ta, int c_start, int c_end) c_end = swap; } + if (ta->sel_start == c_start && ta->sel_end == c_end) + return true; + ta->sel_start = c_start; ta->sel_end = c_end; -- cgit v1.2.3 From 5eb417fff49348f4421de8e2d5f773ae029a4c28 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 29 Jan 2013 22:52:21 +0000 Subject: Create textarea_msg struct on stack, rather than using global. --- desktop/textarea.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 872c6382b..cef2c6c70 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -43,8 +43,6 @@ static plot_style_t pstyle_stroke_caret = { .stroke_width = 1, }; -static struct textarea_msg msg; - struct line_info { unsigned int b_start; /**< Byte offset of line start */ unsigned int b_length; /**< Byte length of line */ @@ -164,6 +162,7 @@ static void textarea_normalise_text(struct textarea *ta, static bool textarea_select(struct textarea *ta, int c_start, int c_end) { int swap; + struct textarea_msg msg; /* Ensure start is the beginning of the selection */ if (c_start > c_end) { @@ -336,6 +335,7 @@ static void textarea_scrollbar_callback(void *client_data, struct scrollbar_msg_data *scrollbar_data) { struct textarea *ta = client_data; + struct textarea_msg msg; switch(scrollbar_data->msg) { case SCROLLBAR_MSG_MOVED: @@ -840,6 +840,7 @@ static bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse, int c_end; size_t b_off; unsigned int c_off; + struct textarea_msg msg; assert(ta->drag_info.type != TEXTAREA_DRAG_NONE); @@ -1037,6 +1038,7 @@ bool textarea_set_caret(struct textarea *ta, int caret) int x0, y0, x1, y1; int text_y_offset; int width, height; + struct textarea_msg msg; if (ta->flags & TEXTAREA_READONLY) return true; @@ -1409,6 +1411,7 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, /* exported interface, documented in textarea.h */ bool textarea_keypress(struct textarea *ta, uint32_t key) { + struct textarea_msg msg; char utf8[6]; unsigned int caret, caret_init, length, l_len, b_off, b_len; int c_line, c_chars, line; @@ -1808,6 +1811,7 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, int sl; /* scrollbar length */ size_t b_off; unsigned int c_off; + struct textarea_msg msg; if (ta->drag_info.type != TEXTAREA_DRAG_NONE && mouse == BROWSER_MOUSE_HOVER) { @@ -1920,6 +1924,8 @@ void textarea_get_dimensions(struct textarea *ta, int *width, int *height) /* exported interface, documented in textarea.h */ void textarea_set_dimensions(struct textarea *ta, int width, int height) { + struct textarea_msg msg; + ta->vis_width = width; ta->vis_height = height; textarea_reflow(ta, 0); -- cgit v1.2.3 From e30e6ec8e9bd435e76261528f055d0b3a6312426 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Tue, 29 Jan 2013 23:58:37 +0000 Subject: Require and bundle Iconv 0.12 --- riscos/distribution/!System/310/Modules/Iconv,ffa | Bin 57476 -> 66240 bytes riscos/distribution/3rdParty/Iconv/ReadMe | 2 +- riscos/distribution/3rdParty/Iconv/doc/ChangeLog | 7 +++++++ riscos/scripts/Run | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/riscos/distribution/!System/310/Modules/Iconv,ffa b/riscos/distribution/!System/310/Modules/Iconv,ffa index b3eb47e32..8a9cc3adb 100644 Binary files a/riscos/distribution/!System/310/Modules/Iconv,ffa and b/riscos/distribution/!System/310/Modules/Iconv,ffa differ diff --git a/riscos/distribution/3rdParty/Iconv/ReadMe b/riscos/distribution/3rdParty/Iconv/ReadMe index fda952a4c..907c2c7c8 100644 --- a/riscos/distribution/3rdParty/Iconv/ReadMe +++ b/riscos/distribution/3rdParty/Iconv/ReadMe @@ -24,7 +24,7 @@ See the ReadMe file in that directory for further information. Licence ======= -Iconv is Copyright © 2004-11 J-M Bell +Iconv is Copyright © 2004-13 J-M Bell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/riscos/distribution/3rdParty/Iconv/doc/ChangeLog b/riscos/distribution/3rdParty/Iconv/doc/ChangeLog index 4c17511d9..3a22a45fa 100644 --- a/riscos/distribution/3rdParty/Iconv/doc/ChangeLog +++ b/riscos/distribution/3rdParty/Iconv/doc/ChangeLog @@ -105,3 +105,10 @@ Iconv Changelog - Toolchain used to build 0.10 turns out to have produced broken code. - Minor additions to the charset alias mapping file. +0.12 20-Jan-2013 +--------------- + + - Master alias mapping file now lives in ROOL repository. + - Correct handling of trailing valid shift sequences. Previously would + erroneously report EINVAL, instead of silently accepting them. + - Add proper transliteration behaviour when requested using //TRANSLIT. diff --git a/riscos/scripts/Run b/riscos/scripts/Run index 45a7748d0..8f3b873ff 100644 --- a/riscos/scripts/Run +++ b/riscos/scripts/Run @@ -88,8 +88,8 @@ RMEnsure Tinct 0.13 Error NetSurf requires Tinct 0.13 or later. This can be down | Ensure Iconv | http://www.netsurf-browser.org/iconv/ -RMEnsure Iconv 0.11 NetSurfRMLoad System:Modules.Iconv -RMEnsure Iconv 0.11 Error NetSurf requires Iconv 0.11 or later. This can be downloaded from http://www.netsurf-browser.org/iconv/ +RMEnsure Iconv 0.12 NetSurfRMLoad System:Modules.Iconv +RMEnsure Iconv 0.12 Error NetSurf requires Iconv 0.12 or later. This can be downloaded from http://www.netsurf-browser.org/iconv/ | Ensure CryptRandom RMEnsure CryptRandom 0.13 NetSurfRMLoad System:Modules.CryptRand -- cgit v1.2.3 From 663191791eda7034c3d7d99a4039eca8ba02b441 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 30 Jan 2013 18:01:01 +0000 Subject: Add move caret msg. Add flag to choose internal caret or caret move msgs. --- atari/toolbar.c | 2 +- desktop/textarea.c | 31 ++++++++++++++++++++++++++----- desktop/textarea.h | 16 ++++++++++++---- desktop/tree.c | 2 +- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/atari/toolbar.c b/atari/toolbar.c index d4feaabfb..cf68194d6 100755 --- a/atari/toolbar.c +++ b/atari/toolbar.c @@ -790,7 +790,7 @@ CMP_TOOLBAR tb_create( struct gui_window * gw ) int ta_height = toolbar_styles[t->style].height; ta_height -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM); textarea_setup ta_setup; - ta_setup.flags = TEXTAREA_DEFAULT; + ta_setup.flags = TEXTAREA_INTERNAL_CARET; ta_setup.width = 300; ta_setup.height = ta_height; ta_setup.pad_top = 0; diff --git a/desktop/textarea.c b/desktop/textarea.c index cef2c6c70..2c7b7484d 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -1173,6 +1173,7 @@ int textarea_get_caret(struct textarea *ta) void textarea_redraw(struct textarea *ta, int x, int y, colour bg, const struct rect *clip, const struct redraw_context *ctx) { + struct textarea_msg msg; const struct plotter_table *plot = ctx->plot; int line0, line1, line, left, right; int chars, text_y_offset, text_y_offset_baseline; @@ -1383,13 +1384,33 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, if ((ta->sel_end == -1 || ta->sel_start == ta->sel_end) && ta->caret_pos.char_off >= 0) { - /* There is no selection, and caret visible: draw caret */ + /* There is no selection, and caret visible: show caret */ int caret_y = y - ta->scroll_y + ta->caret_y + text_y_offset; - int caret_height = caret_y + ta->line_height; - plot->line(x - ta->scroll_x + ta->caret_x, caret_y, - x - ta->scroll_x + ta->caret_x, caret_height, - &pstyle_stroke_caret); + if (ta->flags & TEXTAREA_INTERNAL_CARET) { + /* Render our own caret */ + plot->line(x - ta->scroll_x + ta->caret_x, caret_y, + x - ta->scroll_x + ta->caret_x, + caret_y + ta->line_height, + &pstyle_stroke_caret); + } else { + /* Tell client where caret should be placed */ + msg.ta = ta; + msg.type = TEXTAREA_MSG_MOVED_CARET; + msg.data.caret.hidden = false; + msg.data.caret.x = x - ta->scroll_x + ta->caret_x; + msg.data.caret.y = caret_y; + msg.data.caret.height = ta->line_height; + + ta->callback(ta->data, &msg); + } + } else if (!(ta->flags & TEXTAREA_INTERNAL_CARET)) { + /* Caret hidden, and client is responsible: tell client */ + msg.ta = ta; + msg.type = TEXTAREA_MSG_MOVED_CARET; + msg.data.caret.hidden = true; + + ta->callback(ta->data, &msg); } if (ta->bar_x != NULL) diff --git a/desktop/textarea.h b/desktop/textarea.h index fb8b13425..6a1a4714d 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -34,9 +34,10 @@ struct textarea; /* Text area flags */ typedef enum { - TEXTAREA_DEFAULT = (1 << 0), - TEXTAREA_MULTILINE = (1 << 1), - TEXTAREA_READONLY = (1 << 2) + TEXTAREA_DEFAULT = (1 << 0), /**< Standard input */ + TEXTAREA_MULTILINE = (1 << 1), /**< Multiline area */ + TEXTAREA_READONLY = (1 << 2), /**< Non-editable */ + TEXTAREA_INTERNAL_CARET = (1 << 3) /**< Render own caret */ } textarea_flags; typedef enum { @@ -47,7 +48,8 @@ typedef enum { typedef enum { TEXTAREA_MSG_DRAG_REPORT, /**< Textarea drag start/end report */ - TEXTAREA_MSG_REDRAW_REQUEST /**< Textarea redraw request */ + TEXTAREA_MSG_REDRAW_REQUEST, /**< Textarea redraw request */ + TEXTAREA_MSG_MOVED_CARET /**< Textarea caret moved */ } textarea_msg_type; struct textarea_msg { @@ -57,6 +59,12 @@ struct textarea_msg { union { textarea_drag_type drag; struct rect redraw; + struct { + bool hidden; + int x; + int y; + int height; + } caret; } data; }; diff --git a/desktop/tree.c b/desktop/tree.c index 4f9170d06..959b9870a 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -2972,7 +2972,7 @@ void tree_start_edit(struct tree *tree, struct node_element *element) tree->ta_height = height; - ta_setup.flags = TEXTAREA_DEFAULT; + ta_setup.flags = TEXTAREA_INTERNAL_CARET; ta_setup.width = width; ta_setup.height = tree->ta_height; ta_setup.pad_top = 0; -- cgit v1.2.3 From 89856f55929907642013e45435b9d18cd1fafe36 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 30 Jan 2013 18:23:48 +0000 Subject: ifdef some code that will never work under AmigaOS <4.0 --- amiga/bitmap.c | 5 +++-- amiga/gui.c | 10 +++++++--- amiga/gui_options.c | 10 ++++++++++ amiga/plotters.c | 4 ++++ amiga/theme.c | 2 ++ 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/amiga/bitmap.c b/amiga/bitmap.c index 3a2bc7060..2fa8eb7c7 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -402,6 +402,7 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width, if(GfxBase->LibNode.lib_Version >= 53) // AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1) { +#ifdef __amigaos4__ uint32 comptype = COMPOSITE_Src; uint32 flags = 0; @@ -420,9 +421,9 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width, COMPTAG_OffsetY,0, COMPTAG_FriendBitMap,friendbm, TAG_DONE); +#endif } - else /* do it the old-fashioned way. This is pretty slow, but probably - uses Composite() on OS4.1 anyway, so we're only saving a blit really. */ + else /* Do it the old-fashioned way. This is pretty slow, even on OS4.1 */ { bsa.bsa_SrcX = 0; bsa.bsa_SrcY = 0; diff --git a/amiga/gui.c b/amiga/gui.c index c9645835a..eb5af2662 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -477,15 +477,19 @@ void ami_set_options(void) tree_set_icon_dir(strdup("ENV:Sys")); - nsoption_setnull_charp(arexx_dir, (char *)strdup("Rexx")); - nsoption_setnull_charp(arexx_startup, (char *)strdup("Startup.nsrx")); - nsoption_setnull_charp(arexx_shutdown, (char *)strdup("Shutdown.nsrx")); if(!nsoption_int(window_width)) nsoption_set_int(window_width, 800); if(!nsoption_int(window_height)) nsoption_set_int(window_height, 600); + +#ifndef __amigaos4__ + nsoption_set_bool(download_notify, false); + nsoption_set_bool(context_menu, false); + nsoption_set_bool(font_antialiasing, false); + nsoption_set_bool(truecolour_mouse_pointers, false); +#endif } void ami_amiupdate(void) diff --git a/amiga/gui_options.c b/amiga/gui_options.c index 7e4cef584..bfee47985 100755 --- a/amiga/gui_options.c +++ b/amiga/gui_options.c @@ -731,12 +731,14 @@ void ami_gui_opts_open(void) LAYOUT_SpaceOuter, TRUE, LAYOUT_BevelStyle, BVS_GROUP, LAYOUT_Label, gadlab[GRP_OPTS_MOUSE], +#ifdef __amigaos4__ LAYOUT_AddChild, gow->objects[GID_OPTS_PTRTRUE] = CheckBoxObject, GA_ID, GID_OPTS_PTRTRUE, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_PTRTRUE], GA_Selected, nsoption_bool(truecolour_mouse_pointers), CheckBoxEnd, +#endif LAYOUT_AddChild, gow->objects[GID_OPTS_PTROS] = CheckBoxObject, GA_ID, GID_OPTS_PTROS, GA_RelVerify, TRUE, @@ -1072,6 +1074,7 @@ void ami_gui_opts_open(void) LABEL_Text, gadlab[GID_OPTS_FONT_MINSIZE], LabelEnd, LayoutEnd, +#ifdef __amigaos4__ LAYOUT_AddChild,VGroupObject, LAYOUT_SpaceOuter, TRUE, LAYOUT_BevelStyle, BVS_GROUP, @@ -1083,6 +1086,7 @@ void ami_gui_opts_open(void) GA_Selected, nsoption_bool(font_antialiasing), CheckBoxEnd, LayoutEnd, +#endif LayoutEnd, CHILD_WeightedHeight, 0, LayoutEnd, // page vgroup @@ -1207,6 +1211,7 @@ void ami_gui_opts_open(void) GA_Text, gadlab[GID_OPTS_OVERWRITE], GA_Selected, nsoption_bool(ask_overwrite), CheckBoxEnd, +#ifdef __amigaos4__ LAYOUT_AddChild, gow->objects[GID_OPTS_NOTIFY] = CheckBoxObject, GA_ID, GID_OPTS_NOTIFY, GA_RelVerify, TRUE, @@ -1214,6 +1219,7 @@ void ami_gui_opts_open(void) GA_Text, gadlab[GID_OPTS_NOTIFY], GA_Selected, nsoption_bool(download_notify), CheckBoxEnd, +#endif LayoutEnd, LAYOUT_AddChild, gow->objects[GID_OPTS_DLDIR] = GetFileObject, GA_ID, GID_OPTS_DLDIR, @@ -1246,12 +1252,14 @@ void ami_gui_opts_open(void) GA_Text, gadlab[GID_OPTS_CLOSE_NO_QUIT], GA_Selected, nsoption_bool(close_no_quit), CheckBoxEnd, +#ifdef __amigaos4__ LAYOUT_AddChild, gow->objects[GID_OPTS_DOCKY] = CheckBoxObject, GA_ID, GID_OPTS_DOCKY, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_DOCKY], GA_Selected, !nsoption_bool(hide_docky_icon), CheckBoxEnd, +#endif LayoutEnd, // behaviour CHILD_WeightedHeight, 0, @@ -1294,12 +1302,14 @@ void ami_gui_opts_open(void) LAYOUT_BevelStyle, BVS_GROUP, LAYOUT_Label, gadlab[GRP_OPTS_MISC], LAYOUT_SpaceOuter, TRUE, +#ifdef __amigaos4__ LAYOUT_AddChild, gow->objects[GID_OPTS_CONTEXTMENU] = CheckBoxObject, GA_ID, GID_OPTS_CONTEXTMENU, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_CONTEXTMENU], GA_Selected, nsoption_bool(context_menu), CheckBoxEnd, +#endif LAYOUT_AddChild, gow->objects[GID_OPTS_FASTSCROLL] = CheckBoxObject, GA_ID, GID_OPTS_FASTSCROLL, GA_RelVerify, TRUE, diff --git a/amiga/plotters.c b/amiga/plotters.c index 595ec0d14..ace3c3b53 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -707,6 +707,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false)) { +#ifdef __amigaos4__ uint32 comptype = COMPOSITE_Src; if(!bitmap->opaque) comptype = COMPOSITE_Src_Over_Dest; @@ -722,6 +723,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma COMPTAG_OffsetX,x, COMPTAG_OffsetY,y, TAG_DONE); +#endif } else { @@ -871,6 +873,7 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct Ba if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false)) { +#ifdef __amigaos4__ CompositeTags(COMPOSITE_Src_Over_Dest,bfbm->bm, rp->BitMap, COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha, COMPTAG_DestX,bfmsg->Bounds.MinX, @@ -882,6 +885,7 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct Ba COMPTAG_OffsetX,xf, COMPTAG_OffsetY,yf, TAG_DONE); +#endif } else { diff --git a/amiga/theme.c b/amiga/theme.c index d0808a4a2..fa058e043 100644 --- a/amiga/theme.c +++ b/amiga/theme.c @@ -265,6 +265,7 @@ void ami_init_mouse_pointers(void) mouseptrobj[i] = NULL; char ptrfname[1024]; +#ifdef __amigaos4__ if(nsoption_bool(truecolour_mouse_pointers)) { ami_get_theme_filename((char *)&ptrfname,ptrs32[i], false); @@ -316,6 +317,7 @@ void ami_init_mouse_pointers(void) } } } +#endif if(!mouseptrobj[i]) { -- cgit v1.2.3