From d106091d6e5df26a83460ae484c31753b873368c Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 13 Aug 2012 14:43:04 +0100 Subject: Pass font plot style out to front end clipboard append function. --- amiga/clipboard.c | 7 +++++-- atari/gui.c | 3 ++- beos/window.cpp | 8 +++++--- cocoa/selection.m | 3 ++- desktop/gui.h | 3 ++- desktop/selection.c | 4 ++-- framebuffer/clipboard.c | 3 ++- gtk/selection.c | 7 ++++--- monkey/browser.c | 3 ++- render/textinput.c | 9 +++++---- riscos/textselection.c | 4 +++- windows/gui.c | 3 ++- 12 files changed, 36 insertions(+), 21 deletions(-) diff --git a/amiga/clipboard.c b/amiga/clipboard.c index b09265003..b7450886f 100755 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -17,6 +17,7 @@ */ #include "desktop/gui.h" +#include "desktop/plotters.h" #include "desktop/selection.h" #include "desktop/textinput.h" #include "render/box.h" @@ -245,7 +246,8 @@ bool gui_empty_clipboard(void) return false; } -bool gui_add_to_clipboard(const char *text, size_t length, bool space) +bool gui_add_to_clipboard(const char *text, size_t length, bool space, + const plot_font_style_t *fstyle) { /* This might crash or at least not work if gui_empty_clipboard isn't called first, and gui_commit_clipboard after. @@ -418,7 +420,8 @@ void ami_drag_selection(struct selection *s) bool ami_easy_clipboard(char *text) { if(!gui_empty_clipboard()) return false; - if(!gui_add_to_clipboard(text,strlen(text),false)) return false; + if(!gui_add_to_clipboard(text,strlen(text),false,plot_style_font)) + return false; if(!gui_commit_clipboard()) return false; return true; diff --git a/atari/gui.c b/atari/gui.c index 99b5f9913..2df8ca0c9 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -643,7 +643,8 @@ bool gui_empty_clipboard(void) return true; } -bool gui_add_to_clipboard(const char *text_utf8, size_t length_utf8, bool space) +bool gui_add_to_clipboard(const char *text_utf8, size_t length_utf8, bool space, + const plot_font_style_t *fstyle) { LOG(("(%s): %s (%d)\n", (space)?"space":"", (char*)text_utf8, (int)length_utf8)); char * oldptr = tmp_clipboard; diff --git a/beos/window.cpp b/beos/window.cpp index d62aecf33..572aa86dd 100644 --- a/beos/window.cpp +++ b/beos/window.cpp @@ -1668,7 +1668,8 @@ bool gui_empty_clipboard(void) return true; } -bool gui_add_to_clipboard(const char *text, size_t length, bool space) +bool gui_add_to_clipboard(const char *text, size_t length, bool space, + const plot_font_style_t *fstyle) { BString s; s.SetTo(text, length); @@ -1720,7 +1721,8 @@ static bool copy_handler(const char *text, size_t length, struct box *box, /* add any whitespace which precedes the text from this box */ if (whitespace_text) { if (!gui_add_to_clipboard(whitespace_text, - whitespace_length, false)) { + whitespace_length, false, + plot_style_font)) { return false; } } @@ -1740,7 +1742,7 @@ static bool copy_handler(const char *text, size_t length, struct box *box, } /* add the text from this box */ - if (!gui_add_to_clipboard(text, length, space)) + if (!gui_add_to_clipboard(text, length, space, plot_style_font)) return false; return true; diff --git a/cocoa/selection.m b/cocoa/selection.m index 587f12004..76617d23f 100644 --- a/cocoa/selection.m +++ b/cocoa/selection.m @@ -56,7 +56,8 @@ bool gui_empty_clipboard(void) return true; } -bool gui_add_to_clipboard(const char *text, size_t length, bool space) +bool gui_add_to_clipboard(const char *text, size_t length, bool space, + const plot_font_style_t *fstyle) { if (nil == cocoa_clipboard_string) return false; diff --git a/desktop/gui.h b/desktop/gui.h index 85f1015eb..2fc2b9130 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -129,7 +129,8 @@ void gui_clear_selection(struct gui_window *g); void gui_paste_from_clipboard(struct gui_window *g, int x, int y); bool gui_empty_clipboard(void); -bool gui_add_to_clipboard(const char *text, size_t length, bool space); +bool gui_add_to_clipboard(const char *text, size_t length, bool space, + const plot_font_style_t *fstyle); bool gui_commit_clipboard(void); bool gui_copy_to_clipboard(struct selection *s); diff --git a/desktop/selection.c b/desktop/selection.c index 436117a89..00984d9b1 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -753,7 +753,7 @@ static bool selection_copy_handler(const char *text, size_t length, /* add any whitespace which precedes the text from this box */ if (whitespace_text != NULL && whitespace_length > 0) { if (!gui_add_to_clipboard(whitespace_text, - whitespace_length, false)) { + whitespace_length, false, &style)) { return false; } } @@ -772,7 +772,7 @@ static bool selection_copy_handler(const char *text, size_t length, } /* add the text from this box */ - if (!gui_add_to_clipboard(text, length, add_space)) + if (!gui_add_to_clipboard(text, length, add_space, &style)) return false; return true; diff --git a/framebuffer/clipboard.c b/framebuffer/clipboard.c index d534cfe7a..85e6a1da2 100644 --- a/framebuffer/clipboard.c +++ b/framebuffer/clipboard.c @@ -69,7 +69,8 @@ bool gui_empty_clipboard(void) * \return true iff successful */ -bool gui_add_to_clipboard(const char *text, size_t length, bool space) +bool gui_add_to_clipboard(const char *text, size_t length, bool space, + const plot_font_style_t *fstyle) { size_t new_length = gui_clipboard.length + length + (space ? 1 : 0) + 1; diff --git a/gtk/selection.c b/gtk/selection.c index 14935671f..36d09691d 100644 --- a/gtk/selection.c +++ b/gtk/selection.c @@ -31,12 +31,13 @@ static GString *current_selection = NULL; static GtkClipboard *clipboard; -bool gui_add_to_clipboard(const char *text, size_t length, bool space) +bool gui_add_to_clipboard(const char *text, size_t length, bool space, + const plot_font_style_t *fstyle) { /* add the text from this box */ - current_selection = g_string_append_len (current_selection, + current_selection = g_string_append_len(current_selection, text, length); - if (space) g_string_append (current_selection, " "); + if (space) g_string_append(current_selection, " "); return true; } diff --git a/monkey/browser.c b/monkey/browser.c index 265821cb7..a9cfd046d 100644 --- a/monkey/browser.c +++ b/monkey/browser.c @@ -339,7 +339,8 @@ gui_empty_clipboard(void) } bool -gui_add_to_clipboard(const char *text, size_t length, bool space) +gui_add_to_clipboard(const char *text, size_t length, bool space, + const plot_font_style_t *fstyle) { return true; } diff --git a/render/textinput.c b/render/textinput.c index 0e62d1e5b..3712690d4 100644 --- a/render/textinput.c +++ b/render/textinput.c @@ -554,8 +554,8 @@ static bool textinput_textarea_cut(struct content *c, struct box *next = box->next; if (box->type == BOX_BR) { - if (clipboard && - !gui_add_to_clipboard("\n", 1, false)) { + if (clipboard && !gui_add_to_clipboard("\n", 1, false, + plot_style_font)) { gui_commit_clipboard(); return false; } @@ -565,7 +565,7 @@ static bool textinput_textarea_cut(struct content *c, if (clipboard && !gui_add_to_clipboard(box->text + start_idx, box->length - start_idx, - SPACE_LEN(box))) { + SPACE_LEN(box), plot_style_font)) { gui_commit_clipboard(); return false; } @@ -593,7 +593,8 @@ static bool textinput_textarea_cut(struct content *c, /* and the last box */ if (box) { if (clipboard && !gui_add_to_clipboard(box->text + start_idx, - end_idx - start_idx, end_idx > box->length)) { + end_idx - start_idx, end_idx > box->length, + plot_style_font)) { success = false; } else { if (del) { diff --git a/riscos/textselection.c b/riscos/textselection.c index 06224a5e8..c5a42b548 100644 --- a/riscos/textselection.c +++ b/riscos/textselection.c @@ -229,10 +229,12 @@ void gui_clear_selection(struct gui_window *g) * \param text text to be added * \param length length of text in bytes * \param space indicates whether a trailing space should be appended also + * \param fstyle font plot style for text * \return true iff successful */ -bool gui_add_to_clipboard(const char *text, size_t length, bool space) +bool gui_add_to_clipboard(const char *text, size_t length, bool space, + const plot_font_style_t *fstyle) { size_t new_length = clip_length + length + (space ? 1 : 0); diff --git a/windows/gui.c b/windows/gui.c index 27f55c860..4018cc800 100644 --- a/windows/gui.c +++ b/windows/gui.c @@ -1766,7 +1766,8 @@ bool gui_empty_clipboard(void) return false; } -bool gui_add_to_clipboard(const char *text, size_t length, bool space) +bool gui_add_to_clipboard(const char *text, size_t length, bool space, + const plot_font_style_t *fstyle) { HANDLE hnew; char *new, *original; -- cgit v1.2.3