r10556 vince - in /branches/vince/netsurf-fbtk-rework: Makefile.sources framebuffer/fbtk.h framebuffer/fbtk/corewidgets.c framebuffer/fbtk/event.c framebuffer/fbtk/fbtk.c framebuffer/fbtk/widget.h
by netsurf@semichrome.net
Author: vince
Date: Wed May 26 03:24:31 2010
New Revision: 10556
URL: http://source.netsurf-browser.org?rev=10556&view=rev
Log:
Fix event delivery
Added:
branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/event.c
Modified:
branches/vince/netsurf-fbtk-rework/Makefile.sources
branches/vince/netsurf-fbtk-rework/framebuffer/fbtk.h
branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/corewidgets.c
branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/fbtk.c
branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/widget.h
Modified: branches/vince/netsurf-fbtk-rework/Makefile.sources
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fbtk-rework/Make...
==============================================================================
--- branches/vince/netsurf-fbtk-rework/Makefile.sources (original)
+++ branches/vince/netsurf-fbtk-rework/Makefile.sources Wed May 26 03:24:31 2010
@@ -104,7 +104,8 @@
save.c schedule.c thumbnail.c misc.c bitmap.c filetype.c \
login.c findfile.c
-S_FRAMEBUFFER_FBTK := fbtk.c window.c text.c scroll.c corewidgets.c osk.c
+S_FRAMEBUFFER_FBTK := fbtk.c window.c text.c scroll.c corewidgets.c \
+ osk.c event.c
S_FRAMEBUFFER += font_$(NETSURF_FB_FONTLIB).c
Modified: branches/vince/netsurf-fbtk-rework/framebuffer/fbtk.h
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fbtk-rework/fram...
==============================================================================
--- branches/vince/netsurf-fbtk-rework/framebuffer/fbtk.h (original)
+++ branches/vince/netsurf-fbtk-rework/framebuffer/fbtk.h Wed May 26 03:24:31 2010
@@ -27,6 +27,7 @@
typedef struct fbtk_widget_s fbtk_widget_t;
+/* Widget Callback handling */
typedef enum fbtk_callback_type {
FBTK_CBT_START = 0,
FBTK_CBT_SCROLLX,
@@ -34,6 +35,8 @@
FBTK_CBT_CLICK,
FBTK_CBT_INPUT,
FBTK_CBT_POINTERMOVE,
+ FBTK_CBT_POINTERLEAVE,
+ FBTK_CBT_POINTERENTER,
FBTK_CBT_REDRAW,
FBTK_CBT_DESTROY,
FBTK_CBT_USER,
@@ -52,26 +55,151 @@
typedef int (*fbtk_callback)(fbtk_widget_t *widget, fbtk_callback_info *cbi);
-
-
-
/* enter pressed on writable icon */
typedef int (*fbtk_enter_t)(void *pw, char *text);
-/* helper function to allow simple method to call callbacks */
-int fbtk_post_callback(fbtk_widget_t *widget, fbtk_callback_type cbt, ...);
-
-/* Widget creation */
+
/** Initialise widget toolkit.
*
- * Initialises widget toolkit and creates root window against a framebuffer.
+ * Initialises widget toolkit against a framebuffer.
*
* @param fb The underlying framebuffer.
* @return The root widget handle.
*/
fbtk_widget_t *fbtk_init(nsfb_t *fb);
+
+
+/** Retrive the framebuffer library handle from toolkit widget.
+ *
+ * @param widget A fbtk widget.
+ * @return The underlying framebuffer.
+ */
+nsfb_t *fbtk_get_nsfb(fbtk_widget_t *widget);
+
+/** Helper function to allow simple calling of callbacks with parameters.
+ *
+ * @param widget The fbtk widget to post the callback to.
+ * @param cbt The type of callback to post
+ * @param ... Parameters appropriate for the callback type.
+ */
+int fbtk_post_callback(fbtk_widget_t *widget, fbtk_callback_type cbt, ...);
+
+/** Perform any pending widget redraws.
+ *
+ * @param widget A fbtk widget.
+ */
+int fbtk_redraw(fbtk_widget_t *widget);
+
+/** Determine if there are any redraws pending for a widget.
+ *
+ * Mainly used by clients on the root widget to determine if they need
+ * to call ::fbtk_redraw
+ *
+ * @param widget to check.
+ */
+bool fbtk_get_redraw_pending(fbtk_widget_t *widget);
+
+/** Destroy a widget and all its descendents.
+ *
+ * Removes a widget from the hierachy and frees it and all its children.
+ *
+ * @param widget The widget to destroy.
+ * @return 0 on success or -1 on error.
+ */
+int fbtk_destroy_widget(fbtk_widget_t *widget);
+
+/******************* Event processing **********************/
+
+/** Retrive events from the framebuffer input.
+ *
+ * Obtain events from the framebuffer input system with a
+ * timeout. Some events may be used by the toolkit instead of being
+ * returned to the caller.
+ *
+ * @param root An fbtk widget.
+ * @param event an event structure to update.
+ * @param timeout The number of miliseconds to wait for an event. 0
+ * means do not wait and -1 means wait foreevr.
+ * @return wether \a event has been updated.
+ */
+bool fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout);
+
+/** Insert mouse button press into toolkit.
+ */
+void fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event);
+
+/** Insert input into toolkit.
+ */
+void fbtk_input(fbtk_widget_t *widget, nsfb_event_t *event);
+
+/** Move pointer.
+ *
+ * Move the pointer cursor to a given location.
+ *
+ * @param widget any tookit widget.
+ * @parm x movement in horizontal plane.
+ * @parm y movement in vertical plane.
+ * @parm relative Wheter the /a x and /a y should be considered relative to
+ * current pointer position.
+ */
+void fbtk_warp_pointer(fbtk_widget_t *widget, int x, int y, bool relative);
+
+/** Convert a framebuffer keycode to ucs4.
+ */
+int fbtk_keycode_to_ucs4(int code, uint8_t mods);
+
+
+/******************* Widget Information **********************/
+
+/** Obtain the widget at a point on screen.
+ *
+ * @param widget any tookit widget.
+ * @parm x location in horizontal plane.
+ * @parm y location in vertical plane.
+ * @return widget or NULL.
+ */
+fbtk_widget_t *fbtk_get_widget_at(fbtk_widget_t *widget, int x, int y);
+
+/** Get a widgets absolute horizontal screen co-ordinate.
+ *
+ * @param widget The widget to inspect.
+ * @return The absolute screen co-ordinate.
+ */
+int fbtk_get_absx(fbtk_widget_t *widget);
+
+/** Get a widgets absolute vertical screen co-ordinate.
+ *
+ * @param widget The widget to inspect.
+ * @return The absolute screen co-ordinate.
+ */
+int fbtk_get_absy(fbtk_widget_t *widget);
+
+/** Get a widgets width.
+ *
+ * @param widget The widget to inspect.
+ * @return The widget width.
+ */
+int fbtk_get_width(fbtk_widget_t *widget);
+
+/** Get a widgets height.
+ *
+ * @param widget The widget to inspect.
+ * @return The widget height.
+ */
+int fbtk_get_height(fbtk_widget_t *widget);
+
+
+
+
+
+
+
+
+
+
+
/* enable the on screen keyboard for input */
void fbtk_enable_oskb(fbtk_widget_t *widget);
@@ -179,21 +307,10 @@
/* Widget Destruction */
-/** Destroy and free a widget and all its children.
- *
- * @param widget The widget to destroy.
- * @return 0 on success or -1 on error.
- */
-int fbtk_destroy_widget(fbtk_widget_t *widget);
/* Widget information */
-int fbtk_get_y(fbtk_widget_t *widget);
-int fbtk_get_x(fbtk_widget_t *widget);
-int fbtk_get_width(fbtk_widget_t *widget);
-int fbtk_get_height(fbtk_widget_t *widget);
void *fbtk_get_userpw(fbtk_widget_t *widget);
-nsfb_t *fbtk_get_nsfb(fbtk_widget_t *widget);
/* Set widget properties */
@@ -219,44 +336,18 @@
bool fbtk_clip_rect(const bbox_t * restrict clip, bbox_t * restrict box);
-/** Pointer movement.
- *
- * Pointer has been moved.
- *
- * @param widget any tookit widget.
- * @parm x movement in horizontal plane.
- * @parm y movement in vertical plane.
- * @parm relative Wether the /a x and /a y should be considered relative to
- * current pointer position.
- */
-void fbtk_move_pointer(fbtk_widget_t *widget, int x, int y, bool relative);
-
-/** Mouse has been clicked
- */
-void fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event);
-
-/** Input has been recived
- */
-void fbtk_input(fbtk_widget_t *widget, nsfb_event_t *event);
+
/** Indicate a widget has to be redrawn
*/
void fbtk_request_redraw(fbtk_widget_t *widget);
-/** Cause a redraw to happen.
- */
-int fbtk_redraw(fbtk_widget_t *widget);
-
-bool fbtk_redraw_pending(fbtk_widget_t *widget);
+
int fbtk_count_children(fbtk_widget_t *widget);
bool fbtk_get_bbox(fbtk_widget_t *widget, struct nsfb_bbox_s *bbox);
-bool fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout);
-
-/* keycode to ucs4 */
-int fbtk_keycode_to_ucs4(int code, uint8_t mods);
/* clip a box to a widgets area */
bool fbtk_clip_to_widget(fbtk_widget_t *widget, bbox_t * restrict box);
Modified: branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/corewidgets.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fbtk-rework/fram...
==============================================================================
--- branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/corewidgets.c (original)
+++ branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/corewidgets.c Wed May 26 03:24:31 2010
@@ -27,10 +27,14 @@
#include "utils/log.h"
#include "desktop/browser.h"
+#include "desktop/plotters.h"
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
-#include "framebuffer/fbtk_widget.h"
+#include "framebuffer/bitmap.h"
+#include "framebuffer/image_data.h"
+
+#include "widget.h"
/*************** redraw widgets **************/
Added: branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/event.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fbtk-rework/fram...
==============================================================================
--- branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/event.c (added)
+++ branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/event.c Wed May 26 03:24:31 2010
@@ -1,0 +1,226 @@
+/*
+ * Copyright 2008 Vincent Sanders <vince(a)simtec.co.uk>
+ *
+ * Framebuffer windowing toolkit
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include <libnsfb.h>
+#include <libnsfb_plot.h>
+#include <libnsfb_plot_util.h>
+#include <libnsfb_event.h>
+#include <libnsfb_cursor.h>
+
+#include "utils/utils.h"
+#include "utils/log.h"
+#include "css/css.h"
+#include "desktop/browser.h"
+#include "desktop/plotters.h"
+
+#include "framebuffer/gui.h"
+#include "framebuffer/fbtk.h"
+#include "framebuffer/bitmap.h"
+#include "framebuffer/image_data.h"
+
+#include "widget.h"
+
+void
+fbtk_input(fbtk_widget_t *root, nsfb_event_t *event)
+{
+ fbtk_widget_t *input;
+
+ root = get_root_widget(root);
+
+ /* obtain widget with input focus */
+ input = root->u.root.input;
+ if (input == NULL)
+ return; /* no widget with input */
+
+ fbtk_post_callback(input, FBTK_CBT_INPUT, event);
+}
+
+void
+fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event)
+{
+ fbtk_widget_t *root;
+ fbtk_widget_t *clicked;
+ nsfb_bbox_t cloc;
+ int x, y;
+
+ /* ensure we have the root widget */
+ root = get_root_widget(widget);
+
+ nsfb_cursor_loc_get(root->u.root.fb, &cloc);
+
+ clicked = fbtk_get_widget_at(root, cloc.x0, cloc.y0);
+
+ if (fbtk_get_handler(clicked, FBTK_CBT_INPUT) != NULL) {
+ root->u.root.input = clicked;
+ }
+
+
+ x = fbtk_get_absx(clicked);
+ y = fbtk_get_absy(clicked);
+
+ /* post the click */
+ fbtk_post_callback(clicked, FBTK_CBT_CLICK, event, cloc.x0 - x, cloc.y0 - y);
+}
+
+
+
+void
+fbtk_warp_pointer(fbtk_widget_t *widget, int x, int y, bool relative)
+{
+ fbtk_widget_t *root;
+ fbtk_widget_t *moved;
+ nsfb_bbox_t cloc;
+ int x, y;
+
+ /* ensure we have the root widget */
+ root = get_root_widget(widget);
+
+ if (relative) {
+ nsfb_cursor_loc_get(root->u.root.fb, &cloc);
+ cloc.x0 += x;
+ cloc.y0 += y;
+ } else {
+ cloc.x0 = x;
+ cloc.y0 = y;
+ }
+
+ /* update the pointer cursor */
+ nsfb_cursor_loc_set(root->u.root.fb, &cloc);
+
+ moved = fbtk_get_widget_at(root, cloc.x0, cloc.y0);
+
+ /* post enter and leaving messages */
+ if (moved != root->u.root.prev) {
+ fbtk_post_callback(root->u.root.prev, FBTK_CBT_POINTERLEAVE);
+ root->u.root.prev = moved;
+ fbtk_post_callback(root->u.root.prev, FBTK_CBT_POINTERENTER);
+ }
+
+ x = fbtk_get_absx(moved);
+ y = fbtk_get_absy(moved);
+
+ /* post the movement */
+ fbtk_post_callback(moved, FBTK_CBT_POINTERMOVE, cloc.x0 - x, cloc.y0 - y);
+
+}
+
+bool fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
+{
+ bool unused = false; /* is the event available */
+
+ /* ensure we have the root widget */
+ root = get_root_widget(root);
+
+ //LOG(("Reading event with timeout %d",timeout));
+
+ if (nsfb_event(root->u.root.fb, event, timeout) == false)
+ return false;
+
+ switch (event->type) {
+ case NSFB_EVENT_KEY_DOWN:
+ case NSFB_EVENT_KEY_UP:
+ if ((event->value.controlcode >= NSFB_KEY_MOUSE_1) &&
+ (event->value.controlcode <= NSFB_KEY_MOUSE_5)) {
+ click(root, event);
+ } else {
+ input(root, event);
+ }
+ break;
+
+ case NSFB_EVENT_CONTROL:
+ unused = true;
+ break;
+
+ case NSFB_EVENT_MOVE_RELATIVE:
+ fbtk_warp_pointer(root, event->value.vector.x, event->value.vector.y, true);
+ break;
+
+ case NSFB_EVENT_MOVE_ABSOLUTE:
+ fbtk_warp_pointer(root, event->value.vector.x, event->value.vector.y, false);
+ break;
+
+ default:
+ break;
+
+ }
+ return unused;
+}
+
+static int keymap[] = {
+ /* 0 1 2 3 4 5 6 7 8 9 */
+ -1, -1, -1, -1, -1, -1, -1, -1, 8, 9, /* 0 - 9 */
+ -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, /* 10 - 19 */
+ -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, /* 20 - 29 */
+ -1, -1, ' ', '!', '"', '#', '$', -1, '&','\'', /* 30 - 39 */
+ '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', /* 40 - 49 */
+ '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', /* 50 - 59 */
+ '<', '=', '>', '?', '@', -1, -1, -1, -1, -1, /* 60 - 69 */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 70 - 79 */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 80 - 89 */
+ -1, '[','\\', ']', '~', '_', '`', 'a', 'b', 'c', /* 90 - 99 */
+ 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', /* 100 - 109 */
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', /* 110 - 119 */
+ 'x', 'y', 'z', -1, -1, -1, -1, -1, -1, -1, /* 120 - 129 */
+};
+
+static int sh_keymap[] = {
+ /* 0 1 2 3 4 5 6 7 8 9 */
+ -1, -1, -1, -1, -1, -1, -1, -1, 8, 9, /* 0 - 9 */
+ -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, /* 10 - 19 */
+ -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, /* 20 - 29 */
+ -1, -1, ' ', '!', '"', '~', '$', -1, '&', '@', /* 30 - 39 */
+ '(', ')', '*', '+', '<', '_', '>', '?', ')', '!', /* 40 - 49 */
+ '"', 243, '$', '%', '^', '&', '*', '(', ';', ':', /* 50 - 59 */
+ '<', '+', '>', '?', '@', -1, -1, -1, -1, -1, /* 60 - 69 */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 70 - 79 */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 80 - 89 */
+ -1, '{', '|', '}', '~', '_', 254, 'A', 'B', 'C', /* 90 - 99 */
+ 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', /* 100 - 109 */
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', /* 110 - 119 */
+ 'X', 'Y', 'Z', -1, -1, -1, -1, -1, -1, -1, /* 120 - 129 */
+};
+
+
+/* performs character mapping */
+int
+fbtk_keycode_to_ucs4(int code, uint8_t mods)
+{
+ int ucs4 = -1;
+
+ if (mods) {
+ if ((code >= 0) && (code < (int) NOF_ELEMENTS(sh_keymap)))
+ ucs4 = sh_keymap[code];
+ } else {
+ if ((code >= 0) && (code < (int) NOF_ELEMENTS(keymap)))
+ ucs4 = keymap[code];
+ }
+ return ucs4;
+}
+
+/*
+ * Local Variables:
+ * c-basic-offset:8
+ * End:
+ */
Modified: branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/fbtk.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fbtk-rework/fram...
==============================================================================
--- branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/fbtk.c (original)
+++ branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/fbtk.c Wed May 26 03:24:31 2010
@@ -37,10 +37,10 @@
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
-#include "framebuffer/fbtk_widget.h"
#include "framebuffer/bitmap.h"
#include "framebuffer/image_data.h"
+#include "widget.h"
@@ -110,89 +110,7 @@
}
-/** creates a new widget and insert it into to hierachy.
- *
- * The widget is set to defaults of false, 0 or NULL.
- *
- * @param parent The parent widget. The new widget will be added with
- * the shallowes z order relative to its siblings.
- * @param type The type of the widget.
- * @param x The x co-ordinate relative to the parent widget.
- * @param y The y co-ordinate relative to the parent widget.
- * @param width the widgets width. This will be clipped to the parent, if
- * the value is 0 the largest extent which can fit within the parent
- * is used, if the value is negative the largets vale that will fit
- * within the parent less teh value given will be used.
- * @param height the widgets width. This will be clipped to the parent, if
- * the value is 0 the largest extent which can fit within the parent
- * is used, if the value is negative the largets vale that will fit
- * within the parent less teh value given will be used.
- */
-fbtk_widget_t *
-fbtk_widget_new(fbtk_widget_t *parent,
- enum fbtk_widgettype_e type,
- int x,
- int y,
- int width,
- int height)
-{
- fbtk_widget_t *neww; /* new widget */
- fbtk_widget_t *sibw; /* sibling widget */
-
- if (parent == NULL)
- return NULL;
-
- neww = calloc(1, sizeof(fbtk_widget_t));
- if (neww == NULL)
- return NULL;
-
- /* make new window fit inside parent */
- if (width == 0) {
- width = parent->width - x;
- } else if (width < 0) {
- width = parent->width + width;
- }
- if ((width + x) > parent->width) {
- width = parent->width - x;
- }
-
- if (height == 0) {
- height = parent->height - y;
- } else if (height < 0) {
- height = parent->height + height;
- }
- if ((height + y) > parent->height) {
- height = parent->height - y;
- }
-
- /* set values */
- neww->type = type;
- neww->x = x;
- neww->y = y;
- neww->w = width;
- neww->h = height;
-
- /* insert into widget heiarchy */
-
- neww->parent = parent;
-
- if (parent->first_child == NULL) {
- /* no child widgets yet */
- parent->last_child = neww;
- } else {
- /* add new widget to front of sibling chain */
- neww->next = parent->first_child;
- neww->next->prev = neww;
- }
- parent->first_child = neww;
-
- return neww;
-}
-
-int
-fbtk_widget_free(fbtk_widget_t *widget)
-{
-}
+
/* find the root widget from any widget in the toolkits hierarchy */
fbtk_widget_t *
@@ -219,7 +137,7 @@
if (widget->mapped == false)
return;
- widget->redraw_required = true;
+ widget->redraw.needed = true;
if (widget->type == FB_WIDGET_TYPE_WINDOW) {
fbtk_widget_list_t *lent = widget->u.window.widgets;
@@ -266,31 +184,6 @@
return widget->width;
}
-int
-fbtk_get_x(fbtk_widget_t *widget)
-{
- int x = widget->x;
-
- while (widget->parent != NULL) {
- widget = widget->parent;
- x += widget->x;
- }
-
- return x;
-}
-
-int
-fbtk_get_y(fbtk_widget_t *widget)
-{
- int y = widget->y;
-
- while (widget->parent != NULL) {
- widget = widget->parent;
- y += widget->y;
- }
-
- return y;
-}
/* get widgets bounding box in screen co-ordinates */
bool
@@ -406,71 +299,198 @@
}
-void
-fbtk_input(fbtk_widget_t *root, nsfb_event_t *event)
-{
- fbtk_widget_t *input;
-
- root = get_root_widget(root);
-
- /* obtain widget with input focus */
- input = root->u.root.input;
- if (input == NULL)
- return; /* no widget with input */
-
- fbtk_post_callback(input, FBTK_CBT_INPUT, event);
-}
-
-void
-fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event)
+/* set pointer to bitmap in context on cursor move */
+int
+fbtk_set_ptr_move(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ fbtk_widget_t *root = get_root_widget(widget);
+ struct bitmap *bm = cbi->context;
+
+ nsfb_cursor_set(root->u.root.fb,
+ (nsfb_colour_t *)bm->pixdata,
+ bm->width,
+ bm->height,
+ bm->width);
+
+ return 0;
+}
+
+
+
+
+
+
+
+
+/* exported function documented in fbtk.h */
+int
+fbtk_get_absx(fbtk_widget_t *widget)
+{
+ int x = widget->x;
+
+ while (widget->parent != NULL) {
+ widget = widget->parent;
+ x += widget->x;
+ }
+
+ return x;
+}
+
+/* exported function documented in fbtk.h */
+int
+fbtk_get_absy(fbtk_widget_t *widget)
+{
+ int y = widget->y;
+
+ while (widget->parent != NULL) {
+ widget = widget->parent;
+ y += widget->y;
+ }
+
+ return y;
+}
+
+
+
+/* exported function documented in fbtk.h */
+fbtk_widget_t *
+fbtk_get_widget_at(fbtk_widget_t *nwid, int x, int y)
+{
+ fbtk_widget_t *widget = NULL; /* found widget */
+
+ /* require the root widget to start */
+ nwid = get_root_widget(nwid);
+
+ while (nwid != NULL) {
+ if ((nwid->mapped) &&
+ (x > nwid->x) &&
+ (y > nwid->y) &&
+ (x < nwid->x + nwid->width) &&
+ (y < nwid->y + nwid->height)) {
+ widget = nwid;
+ nwid = nwid->first_child;
+ } else {
+ nwid = nwid->next;
+ }
+ }
+
+ return widget;
+}
+
+
+/* exported function documented in fbtk.h */
+int
+fbtk_widget_destroy(fbtk_widget_t *widget)
+{
+ fbtk_widget_t *parent;
+ int ret = 0;
+
+ ret = fbtk_post_callback(widget, FBTK_CBT_DESTROY);
+
+ while (widget->first_child != NULL) {
+ fbtk_widget_destroy(widget->first_child);
+ }
+
+ parent = widget->parent;
+ if (parent != NULL) {
+
+ /* unlink from siblings */
+ if (widget->prev != NULL) {
+ widget->prev->next = widget->next;
+ } else {
+ /* must be the first widget, unlink from parent */
+ parent->first_child = widget->next;
+ }
+ if (widget->next != NULL) {
+ widget->next->prev = widget->prev;
+ } else {
+ /* must be the last widget, unlink from parent */
+ parent->last_child = widget->prev;
+ }
+
+ free(widget);
+ }
+
+
+ return ret;
+}
+
+
+
+/* internally exported function documented in widget.h */
+fbtk_widget_t *
+fbtk_widget_new(fbtk_widget_t *parent,
+ enum fbtk_widgettype_e type,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ fbtk_widget_t *neww; /* new widget */
+
+ if (parent == NULL)
+ return NULL;
+
+ neww = calloc(1, sizeof(fbtk_widget_t));
+ if (neww == NULL)
+ return NULL;
+
+ /* make new window fit inside parent */
+ if (width == 0) {
+ width = parent->width - x;
+ } else if (width < 0) {
+ width = parent->width + width;
+ }
+ if ((width + x) > parent->width) {
+ width = parent->width - x;
+ }
+
+ if (height == 0) {
+ height = parent->height - y;
+ } else if (height < 0) {
+ height = parent->height + height;
+ }
+ if ((height + y) > parent->height) {
+ height = parent->height - y;
+ }
+
+ /* set values */
+ neww->type = type;
+ neww->x = x;
+ neww->y = y;
+ neww->width = width;
+ neww->height = height;
+
+ /* insert into widget heiarchy */
+
+ neww->parent = parent;
+
+ if (parent->first_child == NULL) {
+ /* no child widgets yet */
+ parent->last_child = neww;
+ } else {
+ /* add new widget to front of sibling chain */
+ neww->next = parent->first_child;
+ neww->next->prev = neww;
+ }
+ parent->first_child = neww;
+
+ return neww;
+}
+
+/* exported function documented in fbtk.h */
+bool
+fbtk_redraw_pending(fbtk_widget_t *widget)
{
fbtk_widget_t *root;
- nsfb_bbox_t cloc;
/* ensure we have the root widget */
root = get_root_widget(widget);
- nsfb_cursor_loc_get(root->u.root.fb, &cloc);
-
-
- /* post the click */
- fbtk_post_callback(root->u.root.rootw, FBTK_CBT_CLICK, event, cloc.x0, cloc.y0);
-}
-
-
-
-void
-fbtk_move_pointer(fbtk_widget_t *widget, int x, int y, bool relative)
-{
- fbtk_widget_t *root;
- nsfb_bbox_t cloc;
-
- /* ensure we have the root widget */
- root = get_root_widget(widget);
-
- if (relative) {
- nsfb_cursor_loc_get(root->u.root.fb, &cloc);
- cloc.x0 += x;
- cloc.y0 += y;
- } else {
- cloc.x0 = x;
- cloc.y0 = y;
- }
-
- root->redraw_required = true;
-
- /* update the pointer cursor */
- nsfb_cursor_loc_set(root->u.root.fb, &cloc);
-
- /* post the movement */
- fbtk_post_callback(root->u.root.rootw, FBTK_CBT_POINTERMOVE, cloc.x0, cloc.y0);
-
-}
-
-
-
-
-/* call the widgets drawing callbacks
+ return root->redraw.needed | root->redraw.child;
+}
+
+/** call the widgets drawing callbacks
*
* This function makes no decisions of its own and simply walks the
* widget tree depth first calling widgets redraw callbacks if flagged
@@ -522,74 +542,8 @@
return do_redraw(root, root);
}
-/* exported function documented in fbtk.h */
-bool
-fbtk_redraw_pending(fbtk_widget_t *widget)
-{
- fbtk_widget_t *root;
-
- /* ensure we have the root widget */
- root = get_root_widget(widget);
-
- return root->redraw.needed | root->redraw.child;
-}
-
-int fbtk_destroy_widget(fbtk_widget_t *widget)
-{
- int ret = 0;
-
- ret = fbtk_post_callback(widget, FBTK_CBT_DESTROY);
-
- free(widget);
-
- return ret;
-}
-
-
-
-static void
-fbtk_width_height(fbtk_widget_t *parent, int x, int y, int *width, int *height)
-{
- /* make widget fit inside parent */
- if (*width == 0) {
- *width = parent->width - x;
- } else if (*width < 0) {
- *width = parent->width + *width;
- }
- if ((*width + x) > parent->width) {
- *width = parent->width - x;
- }
-
- if (*height == 0) {
- *height = parent->height - y;
- } else if (*height < 0) {
- *height = parent->height + *height;
- }
- if ((*height + y) > parent->height) {
- *height = parent->height - y;
- }
-}
-
-
-/* set pointer to bitmap in context on cursor move */
-int
-fbtk_set_ptr_move(fbtk_widget_t *widget, fbtk_callback_info *cbi)
-{
- fbtk_widget_t *root = get_root_widget(widget);
- struct bitmap *bm = cbi->context;
-
- nsfb_cursor_set(root->u.root.fb,
- (nsfb_colour_t *)bm->pixdata,
- bm->width,
- bm->height,
- bm->width);
-
- return 0;
-}
-
-
-
-
+
+/* exported function docuemnted in fbtk.h */
int
fbtk_post_callback(fbtk_widget_t *widget, fbtk_callback_type cbt, ...)
{
@@ -649,49 +603,9 @@
return ret;
}
-bool fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
-{
- bool unused = false; /* is the event available */
-
- /* ensure we have the root widget */
- root = get_root_widget(root);
-
- //LOG(("Reading event with timeout %d",timeout));
-
- if (nsfb_event(root->u.root.fb, event, timeout) == false)
- return false;
-
- switch (event->type) {
- case NSFB_EVENT_KEY_DOWN:
- case NSFB_EVENT_KEY_UP:
- if ((event->value.controlcode >= NSFB_KEY_MOUSE_1) &&
- (event->value.controlcode <= NSFB_KEY_MOUSE_5)) {
- fbtk_click(root, event);
- } else {
- fbtk_input(root, event);
- }
- break;
-
- case NSFB_EVENT_CONTROL:
- unused = true;
- break;
-
- case NSFB_EVENT_MOVE_RELATIVE:
- fbtk_move_pointer(root, event->value.vector.x, event->value.vector.y, true);
- break;
-
- case NSFB_EVENT_MOVE_ABSOLUTE:
- fbtk_move_pointer(root, event->value.vector.x, event->value.vector.y, false);
- break;
-
- default:
- break;
-
- }
- return unused;
-}
-
-
+
+
+/* exported function docuemnted in fbtk.h */
nsfb_t *
fbtk_get_nsfb(fbtk_widget_t *widget)
{
@@ -703,7 +617,7 @@
return root->u.root.fb;
}
-/** Initialise toolkit for use */
+/* exported function docuemnted in fbtk.h */
fbtk_widget_t *
fbtk_init(nsfb_t *fb)
{
@@ -722,57 +636,6 @@
root->mapped = true;
return root;
-}
-
-static int keymap[] = {
- /* 0 1 2 3 4 5 6 7 8 9 */
- -1, -1, -1, -1, -1, -1, -1, -1, 8, 9, /* 0 - 9 */
- -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, /* 10 - 19 */
- -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, /* 20 - 29 */
- -1, -1, ' ', '!', '"', '#', '$', -1, '&','\'', /* 30 - 39 */
- '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', /* 40 - 49 */
- '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', /* 50 - 59 */
- '<', '=', '>', '?', '@', -1, -1, -1, -1, -1, /* 60 - 69 */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 70 - 79 */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 80 - 89 */
- -1, '[','\\', ']', '~', '_', '`', 'a', 'b', 'c', /* 90 - 99 */
- 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', /* 100 - 109 */
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', /* 110 - 119 */
- 'x', 'y', 'z', -1, -1, -1, -1, -1, -1, -1, /* 120 - 129 */
-};
-
-static int sh_keymap[] = {
- /* 0 1 2 3 4 5 6 7 8 9 */
- -1, -1, -1, -1, -1, -1, -1, -1, 8, 9, /* 0 - 9 */
- -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, /* 10 - 19 */
- -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, /* 20 - 29 */
- -1, -1, ' ', '!', '"', '~', '$', -1, '&', '@', /* 30 - 39 */
- '(', ')', '*', '+', '<', '_', '>', '?', ')', '!', /* 40 - 49 */
- '"', 243, '$', '%', '^', '&', '*', '(', ';', ':', /* 50 - 59 */
- '<', '+', '>', '?', '@', -1, -1, -1, -1, -1, /* 60 - 69 */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 70 - 79 */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 80 - 89 */
- -1, '{', '|', '}', '~', '_', 254, 'A', 'B', 'C', /* 90 - 99 */
- 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', /* 100 - 109 */
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', /* 110 - 119 */
- 'X', 'Y', 'Z', -1, -1, -1, -1, -1, -1, -1, /* 120 - 129 */
-};
-
-
-/* performs character mapping */
-int
-fbtk_keycode_to_ucs4(int code, uint8_t mods)
-{
- int ucs4 = -1;
-
- if (mods) {
- if ((code >= 0) && (code < (int) NOF_ELEMENTS(sh_keymap)))
- ucs4 = sh_keymap[code];
- } else {
- if ((code >= 0) && (code < (int) NOF_ELEMENTS(keymap)))
- ucs4 = keymap[code];
- }
- return ucs4;
}
/*
Modified: branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/widget.h
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fbtk-rework/fram...
==============================================================================
--- branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/widget.h (original)
+++ branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/widget.h Wed May 26 03:24:31 2010
@@ -156,7 +156,7 @@
/* toolkit base handle */
struct {
nsfb_t *fb;
- fbtk_widget_t *lastm;
+ fbtk_widget_t *prev; /* previous widget pointer wasin */
fbtk_widget_t *input;
} root;
@@ -190,15 +190,47 @@
};
+/* These functions are not considered part of the public API but are
+ * not static as they are used by the higher level widget provision
+ * routines
+ */
+
+
+/** creates a new widget and insert it into to hierachy.
+ *
+ * The widget is set to defaults of false, 0 or NULL.
+ *
+ * @param parent The parent widget. The new widget will be added with
+ * the shallowest z order relative to its siblings.
+ * @param type The type of the widget.
+ * @param x The x co-ordinate relative to the parent widget.
+ * @param y The y co-ordinate relative to the parent widget.
+ * @param width the widgets width. This will be clipped to the parent, if
+ * the value is 0 the largest extent which can fit within the parent
+ * is used, if the value is negative the largest value that will fit
+ * within the parent less the value given will be used.
+ * @param height the widgets width. This will be clipped to the parent, if
+ * the value is 0 the largest extent which can fit within the parent
+ * is used, if the value is negative the largest value that will fit
+ * within the parent less the value given will be used.
+ */
+fbtk_widget_t *fbtk_widget_new(fbtk_widget_t *parent, enum fbtk_widgettype_e type, int x, int y, int width, int height);
+
+
+
+
+
+
+
+
+
+
+
+
/* widget manipulation functions */
fbtk_widget_t *get_root_widget(fbtk_widget_t *widget);
-/* create a new widget and insert into hierachy */
-fbtk_widget_t *fbtk_widget_new(fbtk_widget_t *parent,
- enum fbtk_widgettype_e type,
- int x, int y, int w, int h);
-
fbtk_widget_t *add_widget_to_window(fbtk_widget_t *window, fbtk_widget_t *widget);
int fbtk_set_ptr_move(fbtk_widget_t *widget, fbtk_callback_info *cbi);
13 years, 3 months
r10553 tlsa - in /trunk/netsurfweb/downloads/themes: Dinky.theme Dinkyi.png index.en
by netsurf@semichrome.net
Author: tlsa
Date: Fri May 21 04:02:01 2010
New Revision: 10553
URL: http://source.netsurf-browser.org?rev=10553&view=rev
Log:
Add Dinky theme by Gavin Wraith and fix theme links.
Added:
trunk/netsurfweb/downloads/themes/Dinky.theme (with props)
trunk/netsurfweb/downloads/themes/Dinkyi.png (with props)
Modified:
trunk/netsurfweb/downloads/themes/index.en
Added: trunk/netsurfweb/downloads/themes/Dinky.theme
URL: http://source.netsurf-browser.org/trunk/netsurfweb/downloads/themes/Dinky...
==============================================================================
Binary file - no diff available.
Propchange: trunk/netsurfweb/downloads/themes/Dinky.theme
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/netsurfweb/downloads/themes/Dinkyi.png
URL: http://source.netsurf-browser.org/trunk/netsurfweb/downloads/themes/Dinky...
==============================================================================
Binary file - no diff available.
Propchange: trunk/netsurfweb/downloads/themes/Dinkyi.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: trunk/netsurfweb/downloads/themes/index.en
URL: http://source.netsurf-browser.org/trunk/netsurfweb/downloads/themes/index...
==============================================================================
--- trunk/netsurfweb/downloads/themes/index.en (original)
+++ trunk/netsurfweb/downloads/themes/index.en Fri May 21 04:02:01 2010
@@ -57,37 +57,42 @@
<h2 class="themename">Aquatic</h2>
-<p class="themeimage"><a href="Aquatic"><img src="Aquatici.png" alt="Install theme"></a></p>
+<p class="themeimage"><a href="Aquatic.theme"><img src="Aquatici.png" alt="Install theme"></a></p>
<p class="themeauthor">Author: Matt Aubury (Port: <a href="http://www.richardspencer.freeuk.com/">Richard Spencer</a>)</p>
+
+<h2 class="themename">Dinky</h2>
+
+<p class="themeimage"><a href="Dinky.theme"><img src="Dinkyi.png" alt="Install theme"></a></p>
+<p class="themeauthor">Author: <a href="http://www.wra1th.plus.com/">Gavin Wraith</a></p>
<h2 class="themename">IYONIX</h2>
-<p class="themeimage"><a href="Iyonix"><img src="Iyonixi.png" alt="Install theme"></a></p>
+<p class="themeimage"><a href="Iyonix.theme"><img src="Iyonixi.png" alt="Install theme"></a></p>
<p class="themeauthor">Author: <a href="http://hallas.net/">Richard G. Hallas</a></p>
<h2 class="themename">Kemp</h2>
-<p class="themeimage"><a href="Kemp"><img src="Kempi.png" alt="Install theme"></a></p>
+<p class="themeimage"><a href="Kemp.theme"><img src="Kempi.png" alt="Install theme"></a></p>
<p class="themeauthor">Author: <a href="http://quadrone.org/">Arvid Axelsson</a> (Port: <a href="http://www.wra1th.plus.com/">Gavin Wraith</a>)</p>
<h2 class="themename">Qute</h2>
-<p class="themeimage"><a href="Qute"><img src="Qutei.png" alt="Install theme"></a></p>
+<p class="themeimage"><a href="Qute.theme"><img src="Qutei.png" alt="Install theme"></a></p>
<p class="themeauthor">Author: <a href="http://quadrone.org/">Arvid Axelsson</a> (Port: <a href="http://www.quantumsoft.co.uk/">Stuart Halliday</a>)</p>
<h2 class="themename">Remembrance</h2>
-<p class="themeimage"><a href="Remembrance"><img src="Remembrancei.png" alt="Install theme"></a></p>
+<p class="themeimage"><a href="Remembrance.theme"><img src="Remembrancei.png" alt="Install theme"></a></p>
<p class="themeauthor">Author: Matt Aubury (Port: <a href="http://www.richardspencer.freeuk.com/">Richard Spencer</a>)</p>
<h2 class="themename">RISC OS 5</h2>
-<p class="themeimage"><a href="RO5"><img src="RO5i.png" alt="Install theme"></a></p>
+<p class="themeimage"><a href="RO5.theme"><img src="RO5i.png" alt="Install theme"></a></p>
<p class="themeauthor">Author: <a href="http://hallas.net/">Richard G. Hallas</a></p>
<h2 class="themename">Steel</h2>
-<p class="themeimage"><a href="Steel"><img src="Steeli.png" alt="Install theme"></a></p>
+<p class="themeimage"><a href="Steel.theme"><img src="Steeli.png" alt="Install theme"></a></p>
<p class="themeauthor">Author: <a href="http://lym.iconbar.com/">Chris Wraight</a></p>
13 years, 4 months
r10552 chris_y - /trunk/netsurf/amiga/search.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun May 16 11:04:40 2010
New Revision: 10552
URL: http://source.netsurf-browser.org?rev=10552&view=rev
Log:
Activate browser window after search, otherwise it doesn't get IntuiTicks events so
won't scroll to the search term.
Modified:
trunk/netsurf/amiga/search.c
Modified: trunk/netsurf/amiga/search.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/search.c?rev=10552&...
==============================================================================
--- trunk/netsurf/amiga/search.c (original)
+++ trunk/netsurf/amiga/search.c Sun May 16 11:04:40 2010
@@ -234,6 +234,7 @@
search_step(fwin->gwin->shared->bw->search_context,
flags,
ami_search_string());
+ ActivateWindow(fwin->gwin->shared->win);
break;
case GID_PREV:
@@ -246,6 +247,7 @@
search_step(fwin->gwin->shared->bw->search_context,
flags,
ami_search_string());
+ ActivateWindow(fwin->gwin->shared->win);
break;
case GID_SEARCHSTRING:
13 years, 4 months
r10551 chris_y - in /trunk/netsurf: !NetSurf/Resources/de/Messages !NetSurf/Resources/en/Messages !NetSurf/Resources/fr/Messages !NetSurf/Resources/it/Messages !NetSurf/Resources/nl/Messages amiga/font.c amiga/gui.c amiga/gui_options.c amiga/options.h
by netsurf@semichrome.net
Author: chris_y
Date: Thu May 6 05:02:58 2010
New Revision: 10551
URL: http://source.netsurf-browser.org?rev=10551&view=rev
Log:
Amiga font code revamped and fixed. Will now fall back to a different font if the
character isn't present in the current one, this needs a complete or near-complete
Unicode font in order to be useful - Code2000 and Bitstream Cyberbit are auto-detected
by NetSurf on startup if none is configured. Japanese websites now display correctly,
along with Japanese characters within Google UK search results etc.
Modified:
trunk/netsurf/!NetSurf/Resources/de/Messages
trunk/netsurf/!NetSurf/Resources/en/Messages
trunk/netsurf/!NetSurf/Resources/fr/Messages
trunk/netsurf/!NetSurf/Resources/it/Messages
trunk/netsurf/!NetSurf/Resources/nl/Messages
trunk/netsurf/amiga/font.c
trunk/netsurf/amiga/gui.c
trunk/netsurf/amiga/gui_options.c
trunk/netsurf/amiga/options.h
Modified: trunk/netsurf/!NetSurf/Resources/de/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/de/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/de/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/de/Messages Thu May 6 05:02:58 2010
@@ -1352,6 +1352,7 @@
FontMono:Monospace
FontCursive:Kursiv
FontFantasy:Fantasy
+FontFallback:Fallback (Unicode)
Default:Standard
FontSize:SchriftgröÃe
Minimum:Minimum
Modified: trunk/netsurf/!NetSurf/Resources/en/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/en/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/en/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/en/Messages Thu May 6 05:02:58 2010
@@ -1357,6 +1357,7 @@
FontMono:Monospaced
FontCursive:Cursive
FontFantasy:Fantasy
+FontFallback:Fallback (Unicode)
Default:Default
FontSize:Font size
Minimum:Minimum
Modified: trunk/netsurf/!NetSurf/Resources/fr/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/fr/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/fr/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/fr/Messages Thu May 6 05:02:58 2010
@@ -1358,6 +1358,7 @@
FontMono:Monospaced
FontCursive:Cursive
FontFantasy:Fantasy
+FontFallback:Fallback (Unicode)
Default:Default
FontSize:Font size
Minimum:Minimum
Modified: trunk/netsurf/!NetSurf/Resources/it/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/it/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/it/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/it/Messages Thu May 6 05:02:58 2010
@@ -1358,6 +1358,7 @@
FontMono:Monospaziato
FontCursive:Corsivo
FontFantasy:Fantasia
+FontFallback:Fallback (Unicode)
Default:Predefinito
FontSize:Dimensione Font
Minimum:Minimo
Modified: trunk/netsurf/!NetSurf/Resources/nl/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/nl/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/nl/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/nl/Messages Thu May 6 05:02:58 2010
@@ -1353,6 +1353,7 @@
FontMono:Monospaced
FontCursive:Cursive
FontFantasy:Fantasy
+FontFallback:Fallback (Unicode)
Default:Default
FontSize:Font size
Minimum:Minimum
Modified: trunk/netsurf/amiga/font.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/font.c?rev=10551&r1...
==============================================================================
--- trunk/netsurf/amiga/font.c (original)
+++ trunk/netsurf/amiga/font.c Thu May 6 05:02:58 2010
@@ -36,12 +36,16 @@
#include <proto/utility.h>
#include "utils/utils.h"
-static struct OutlineFont *of[PLOT_FONT_FAMILY_COUNT];
-static struct OutlineFont *ofb[PLOT_FONT_FAMILY_COUNT];
-static struct OutlineFont *ofi[PLOT_FONT_FAMILY_COUNT];
-static struct OutlineFont *ofbi[PLOT_FONT_FAMILY_COUNT];
-
-struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle);
+#define NSA_UNICODE_FONT PLOT_FONT_FAMILY_COUNT
+
+static struct OutlineFont *of[PLOT_FONT_FAMILY_COUNT+1];
+static struct OutlineFont *ofb[PLOT_FONT_FAMILY_COUNT+1];
+static struct OutlineFont *ofi[PLOT_FONT_FAMILY_COUNT+1];
+static struct OutlineFont *ofbi[PLOT_FONT_FAMILY_COUNT+1];
+
+int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
+ uint16 char1, uint16 char2, uint32 x, uint32 y, uint32 emwidth);
+struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle, BOOL fallback);
static bool nsfont_width(const plot_font_style_t *fstyle,
const char *string, size_t length,
@@ -65,9 +69,9 @@
const char *string, size_t length,
int *width)
{
- struct TextFont *tfont;
-
*width = ami_unicode_text(NULL,string,length,fstyle,0,0);
+
+ if(*width <= 0) *width == length; // fudge
return true;
}
@@ -93,7 +97,7 @@
uint16 *utf16 = NULL, *outf16 = NULL;
uint16 utf16next = NULL;
FIXED kern = 0;
- struct OutlineFont *ofont;
+ struct OutlineFont *ofont, *ufont = NULL;
struct GlyphMap *glyph;
uint32 tx=0,i=0;
size_t len, utf8len = 0;
@@ -101,13 +105,13 @@
uint32 co = 0;
int utf16charlen;
ULONG emwidth = (ULONG)((fstyle->size / FONT_SIZE_SCALE) * glob->scale);
- ULONG charwidth;
+ int32 tempx;
len = utf8_bounded_length(string, length);
if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != UTF8_CONVERT_OK) return false;
outf16 = utf16;
- if(!(ofont = ami_open_outline_font(fstyle))) return false;
+ if(!(ofont = ami_open_outline_font(fstyle, FALSE))) return false;
*char_offset = length;
@@ -122,41 +126,41 @@
utf16next = utf16[utf16charlen];
- if(ESetInfo(&ofont->olf_EEngine,
- OT_GlyphCode, *utf16,
- OT_GlyphCode2, utf16next,
- TAG_END) == OTERR_Success)
- {
- if(EObtainInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,&glyph,
- TAG_END) == 0)
- {
- kern = 0;
-
- if(utf16next) EObtainInfo(&ofont->olf_EEngine,
- OT_TextKernPair, &kern,
- TAG_END);
-
- charwidth = (ULONG)(((glyph->glm_Width - kern) * emwidth) / 65536);
-
- if(x < (tx + charwidth))
- {
- *actual_x = tx;
- i = len+1;
- }
- else
- {
- co += utf8len;
- }
-
- tx += charwidth;
-
- EReleaseInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,glyph,
- TAG_END);
- }
- }
-
+ tempx = ami_font_plot_glyph(ofont, NULL, *utf16, utf16next,
+ 0, 0, emwidth);
+
+ if(tempx == 0)
+ {
+ if(ufont == NULL)
+ {
+ ufont = ami_open_outline_font(fstyle, TRUE);
+ }
+
+ if(ufont)
+ {
+ tempx = ami_font_plot_glyph(ufont, NULL, *utf16, utf16next,
+ 0, 0, emwidth);
+ }
+/*
+ if(tempx == 0)
+ {
+ tempx = ami_font_plot_glyph(ofont, NULL, 0xfffd, utf16next,
+ 0, 0, emwidth);
+ }
+*/
+ }
+
+ if(x < (tx + tempx))
+ {
+ *actual_x = tx;
+ i = len+1;
+ }
+ else
+ {
+ co += utf8len;
+ }
+
+ tx += tempx;
string += utf8len;
utf16 += utf16charlen;
}
@@ -203,17 +207,18 @@
uint16 utf16next = 0;
FIXED kern = 0;
int utf16charlen = 0;
- struct OutlineFont *ofont;
+ struct OutlineFont *ofont, *ufont = NULL;
struct GlyphMap *glyph;
uint32 tx=0,i=0;
size_t len;
int utf8len, utf8clen = 0;
+ int32 tempx = 0;
ULONG emwidth = (ULONG)((fstyle->size / FONT_SIZE_SCALE) * glob->scale);
len = utf8_bounded_length(string, length);
if(utf8_to_enc((char *)string,"UTF-16",length,(char **)&utf16) != UTF8_CONVERT_OK) return false;
outf16 = utf16;
- if(!(ofont = ami_open_outline_font(fstyle))) return false;
+ if(!(ofont = ami_open_outline_font(fstyle, FALSE))) return false;
*char_offset = 0;
*actual_x = 0;
@@ -229,36 +234,43 @@
utf16next = utf16[utf16charlen];
- if(ESetInfo(&ofont->olf_EEngine,
- OT_GlyphCode, *utf16,
- OT_GlyphCode2, utf16next,
- TAG_END) == OTERR_Success)
- {
- if(EObtainInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,&glyph,
- TAG_END) == 0)
- {
- if(x < tx)
- {
- i = length+1;
- }
- else
- {
- if(string[utf8clen] == ' ') //*utf16 == 0x0020)
- {
- *actual_x = tx;
- *char_offset = utf8clen;
- }
- }
-
- tx += (ULONG)(((glyph->glm_Width - kern) * emwidth) / 65536);
-
- EReleaseInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,glyph,
- TAG_END);
- }
- }
-
+ if(x < tx)
+ {
+ i = length+1;
+ }
+ else
+ {
+ if(string[utf8clen] == ' ') //*utf16 == 0x0020)
+ {
+ *actual_x = tx;
+ *char_offset = utf8clen;
+ }
+ }
+
+ tempx = ami_font_plot_glyph(ofont, NULL, *utf16, utf16next, 0, 0, emwidth);
+
+ if(tempx == 0)
+ {
+ if(ufont == NULL)
+ {
+ ufont = ami_open_outline_font(fstyle, TRUE);
+ }
+
+ if(ufont)
+ {
+ tempx = ami_font_plot_glyph(ufont, NULL, *utf16, utf16next,
+ 0, 0, emwidth);
+ }
+/*
+ if(tempx == 0)
+ {
+ tempx = ami_font_plot_glyph(ofont, NULL, 0xfffd, utf16next,
+ 0, 0, emwidth);
+ }
+*/
+ }
+
+ tx += tempx;
utf16 += utf16charlen;
utf8clen += utf8len;
}
@@ -268,12 +280,23 @@
return true;
}
-struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle)
+/**
+ * Open an outline font in the specified size and style
+ *
+ * \param fstyle font style structure
+ * \param default open a default font instead of the one specified by fstyle
+ * \return outline font or NULL on error
+ */
+struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle, BOOL fallback)
{
struct OutlineFont *ofont;
char *fontname;
ULONG ysize;
int tstyle = 0;
+ plot_font_generic_family_t fontfamily;
+
+ if(fallback) fontfamily = NSA_UNICODE_FONT;
+ else fontfamily = fstyle->family;
if ((fstyle->flags & FONTF_ITALIC) || (fstyle->flags & FONTF_OBLIQUE))
tstyle += NSA_ITALIC;
@@ -284,22 +307,22 @@
switch(tstyle)
{
case NSA_ITALIC:
- if(ofi[fstyle->family]) ofont = ofi[fstyle->family];
- else ofont = of[fstyle->family];
+ if(ofi[fontfamily]) ofont = ofi[fontfamily];
+ else ofont = of[fontfamily];
break;
case NSA_BOLD:
- if(ofb[fstyle->family]) ofont = ofb[fstyle->family];
- else ofont = of[fstyle->family];
+ if(ofb[fontfamily]) ofont = ofb[fontfamily];
+ else ofont = of[fontfamily];
break;
case NSA_BOLDITALIC:
- if(ofbi[fstyle->family]) ofont = ofbi[fstyle->family];
- else ofont = of[fstyle->family];
+ if(ofbi[fontfamily]) ofont = ofbi[fontfamily];
+ else ofont = of[fontfamily];
break;
default:
- ofont = of[fstyle->family];
+ ofont = of[fontfamily];
break;
}
@@ -317,38 +340,82 @@
return NULL;
}
+int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
+ uint16 char1, uint16 char2, uint32 x, uint32 y, uint32 emwidth)
+{
+ struct GlyphMap *glyph;
+ UBYTE *glyphbm;
+ int32 char_advance = 0;
+ FIXED kern = 0;
+
+ if(ESetInfo(&ofont->olf_EEngine,
+ OT_GlyphCode, char1,
+ OT_GlyphCode2, char2,
+ TAG_END) == OTERR_Success)
+ {
+ if(EObtainInfo(&ofont->olf_EEngine,
+ OT_GlyphMap8Bit,&glyph,
+ TAG_END) == 0)
+ {
+ glyphbm = glyph->glm_BitMap;
+ if(!glyphbm) return 0;
+
+ if(rp)
+ {
+ BltBitMapTags(BLITA_SrcX, glyph->glm_BlackLeft,
+ BLITA_SrcY, glyph->glm_BlackTop,
+ BLITA_DestX, x - glyph->glm_X0 + glyph->glm_BlackLeft,
+ BLITA_DestY, y - glyph->glm_Y0 + glyph->glm_BlackTop,
+ BLITA_Width, glyph->glm_BlackWidth,
+ BLITA_Height, glyph->glm_BlackHeight,
+ BLITA_Source, glyphbm,
+ BLITA_SrcType, BLITT_ALPHATEMPLATE,
+ BLITA_Dest, rp,
+ BLITA_DestType, BLITT_RASTPORT,
+ BLITA_SrcBytesPerRow, glyph->glm_BMModulo,
+ TAG_DONE);
+ }
+
+ kern = 0;
+
+ if(char2) EObtainInfo(&ofont->olf_EEngine,
+ OT_TextKernPair, &kern,
+ TAG_END);
+
+ char_advance = (ULONG)(((glyph->glm_Width - kern) * emwidth) / 65536);
+
+ EReleaseInfo(&ofont->olf_EEngine,
+ OT_GlyphMap8Bit,glyph,
+ TAG_END);
+ }
+ }
+
+ return char_advance;
+}
+
ULONG ami_unicode_text(struct RastPort *rp,const char *string,ULONG length,const plot_font_style_t *fstyle,ULONG dx, ULONG dy)
{
uint16 *utf16 = NULL, *outf16 = NULL;
uint16 utf16next = 0;
int utf16charlen;
- FIXED kern = 0;
- struct OutlineFont *ofont;
- struct GlyphMap *glyph;
+ struct OutlineFont *ofont, *ufont = NULL;
ULONG i,gx,gy;
- UBYTE *glyphbm;
UWORD posn;
- struct BitMap *tbm;
- struct RastPort trp;
- uint32 width,height;
- uint32 x=0,y=0;
- size_t len;
+ uint32 x=0;
uint8 co = 0;
+ int32 tempx = 0;
ULONG emwidth = (ULONG)((fstyle->size / FONT_SIZE_SCALE) * glob->scale);
if(!string || string[0]=='\0') return 0;
if(!length) return 0;
- len = utf8_bounded_length(string, length);
if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != UTF8_CONVERT_OK) return 0;
outf16 = utf16;
- if(!(ofont = ami_open_outline_font(fstyle))) return 0;
+ if(!(ofont = ami_open_outline_font(fstyle, FALSE))) return 0;
if(rp) SetRPAttrs(rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,fstyle->foreground),TAG_DONE);
- dy++;
-
- for(i=0;i<=len;i++)
+ while(*utf16 != 0)
{
if (*utf16 < 0xD800 || 0xDFFF < *utf16)
utf16charlen = 1;
@@ -357,47 +424,31 @@
utf16next = utf16[utf16charlen];
- if(ESetInfo(&ofont->olf_EEngine,
- OT_GlyphCode, *utf16,
- OT_GlyphCode2, utf16next,
- TAG_END) == OTERR_Success)
- {
- if(EObtainInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,&glyph,
- TAG_END) == 0)
- {
- glyphbm = glyph->glm_BitMap;
- if(!glyphbm) continue;
-
- if(rp)
- {
- BltBitMapTags(BLITA_SrcX,glyph->glm_BlackLeft,
- BLITA_SrcY,glyph->glm_BlackTop,
- BLITA_DestX,dx + x - glyph->glm_X0 + glyph->glm_BlackLeft,
- BLITA_DestY,dy - glyph->glm_Y0 + glyph->glm_BlackTop,
- BLITA_Width,glyph->glm_BlackWidth,
- BLITA_Height,glyph->glm_BlackHeight,
- BLITA_Source,glyphbm,
- BLITA_SrcType,BLITT_ALPHATEMPLATE,
- BLITA_Dest,rp,
- BLITA_DestType,BLITT_RASTPORT,
- BLITA_SrcBytesPerRow,glyph->glm_BMModulo,
- TAG_DONE);
- }
-
- kern = 0;
-
- if(utf16next) EObtainInfo(&ofont->olf_EEngine,
- OT_TextKernPair, &kern,
- TAG_END);
-
- x += (ULONG)(((glyph->glm_Width - kern) * emwidth) / 65536);
-
- EReleaseInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,glyph,
- TAG_END);
- }
- }
+ tempx = ami_font_plot_glyph(ofont, rp, *utf16, utf16next, dx + x, dy, emwidth);
+
+ if(tempx == 0)
+ {
+ if(ufont == NULL)
+ {
+ ufont = ami_open_outline_font(fstyle, TRUE);
+ }
+
+ if(ufont)
+ {
+ tempx = ami_font_plot_glyph(ufont, rp, *utf16, utf16next,
+ dx + x, dy, emwidth);
+ }
+/*
+ if(tempx == 0)
+ {
+ tempx = ami_font_plot_glyph(ofont, rp, 0xfffd, utf16next,
+ dx + x, dy, emwidth);
+ }
+*/
+ }
+
+ x += tempx;
+
utf16 += utf16charlen;
}
@@ -438,8 +489,9 @@
of[PLOT_FONT_FAMILY_MONOSPACE] = OpenOutlineFont(option_font_mono,NULL,OFF_OPEN);
of[PLOT_FONT_FAMILY_CURSIVE] = OpenOutlineFont(option_font_cursive,NULL,OFF_OPEN);
of[PLOT_FONT_FAMILY_FANTASY] = OpenOutlineFont(option_font_fantasy,NULL,OFF_OPEN);
-
- for(i=PLOT_FONT_FAMILY_SANS_SERIF;i<=PLOT_FONT_FAMILY_FANTASY;i++)
+ of[NSA_UNICODE_FONT] = OpenOutlineFont(option_font_unicode,NULL,OFF_OPEN);
+
+ for(i=PLOT_FONT_FAMILY_SANS_SERIF;i<=NSA_UNICODE_FONT;i++)
{
if(!of[i])
{
@@ -460,6 +512,9 @@
break;
case PLOT_FONT_FAMILY_FANTASY:
tmpfontname = option_font_fantasy;
+ break;
+ case NSA_UNICODE_FONT:
+ tmpfontname = option_font_unicode;
break;
default:
/* should never get here, but just in case */
@@ -503,7 +558,7 @@
{
int i=0;
- for(i=PLOT_FONT_FAMILY_SANS_SERIF;i<=PLOT_FONT_FAMILY_FANTASY;i++)
+ for(i=PLOT_FONT_FAMILY_SANS_SERIF;i<=NSA_UNICODE_FONT;i++)
{
if(of[i]) CloseOutlineFont(of[i],NULL);
if(ofb[i]) CloseOutlineFont(ofb[i],NULL);
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=10551&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Thu May 6 05:02:58 2010
@@ -299,6 +299,7 @@
void ami_set_options(void)
{
STRPTR tempacceptlangs;
+ BPTR lock = 0;
/* The following line disables the popupmenu.class select menu
** This will become a user option when/if popupmenu.class is
@@ -363,6 +364,23 @@
if((!option_font_fantasy) || (option_font_fantasy[0] == '\0'))
option_font_fantasy = (char *)strdup("DejaVu Serif");
+
+ if((!option_font_unicode) || (option_font_unicode[0] == '\0'))
+ {
+ /* Search for some likely candidates */
+
+ if(lock=Lock("FONTS:Code2000.font",ACCESS_READ))
+ {
+ UnLock(lock);
+ option_font_unicode = (char *)strdup("Code2000");
+ }
+ else if(lock=Lock("FONTS:Bitstream Cyberbit.font",ACCESS_READ))
+ {
+ UnLock(lock);
+ option_font_unicode = (char *)strdup("Bitstream Cyberbit");
+ }
+ else option_font_unicode = (char *)strdup("Deja Vu Sans");
+ }
if((!option_theme) || (option_theme[0] == '\0'))
option_theme = (char *)strdup("PROGDIR:Resources/Themes/Default");
Modified: trunk/netsurf/amiga/gui_options.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui_options.c?rev=1...
==============================================================================
--- trunk/netsurf/amiga/gui_options.c (original)
+++ trunk/netsurf/amiga/gui_options.c Thu May 6 05:02:58 2010
@@ -97,6 +97,7 @@
GID_OPTS_FONT_MONO,
GID_OPTS_FONT_CURSIVE,
GID_OPTS_FONT_FANTASY,
+ GID_OPTS_FONT_UNICODE,
GID_OPTS_FONT_DEFAULT,
GID_OPTS_FONT_SIZE,
GID_OPTS_FONT_MINSIZE,
@@ -259,6 +260,7 @@
gadlab[GID_OPTS_FONT_MONO] = (char *)ami_utf8_easy((char *)messages_get("FontMono"));
gadlab[GID_OPTS_FONT_CURSIVE] = (char *)ami_utf8_easy((char *)messages_get("FontCursive"));
gadlab[GID_OPTS_FONT_FANTASY] = (char *)ami_utf8_easy((char *)messages_get("FontFantasy"));
+ gadlab[GID_OPTS_FONT_UNICODE] = (char *)ami_utf8_easy((char *)messages_get("FontFallback"));
gadlab[GID_OPTS_FONT_DEFAULT] = (char *)ami_utf8_easy((char *)messages_get("Default"));
gadlab[GID_OPTS_FONT_SIZE] = (char *)ami_utf8_easy((char *)messages_get("Default"));
gadlab[GID_OPTS_FONT_MINSIZE] = (char *)ami_utf8_easy((char *)messages_get("Minimum"));
@@ -367,7 +369,7 @@
BOOL scaleselected = option_scale_quality, scaledisabled = FALSE;
BOOL download_notify_disabled = FALSE;
char animspeed[10];
- struct TextAttr fontsans, fontserif, fontmono, fontcursive, fontfantasy;
+ struct TextAttr fontsans, fontserif, fontmono, fontcursive, fontfantasy, fontunicode;
if(option_use_pubscreen && option_use_pubscreen[0] != '\0')
{
@@ -438,24 +440,28 @@
fontmono.ta_Name = ASPrintf("%s.font",option_font_mono);
fontcursive.ta_Name = ASPrintf("%s.font",option_font_cursive);
fontfantasy.ta_Name = ASPrintf("%s.font",option_font_fantasy);
+ fontunicode.ta_Name = ASPrintf("%s.font",option_font_unicode);
fontsans.ta_Style = 0;
fontserif.ta_Style = 0;
fontmono.ta_Style = 0;
fontcursive.ta_Style = 0;
fontfantasy.ta_Style = 0;
+ fontunicode.ta_Style = 0;
fontsans.ta_YSize = 0;
fontserif.ta_YSize = 0;
fontmono.ta_YSize = 0;
fontcursive.ta_YSize = 0;
fontfantasy.ta_YSize = 0;
+ fontunicode.ta_YSize = 0;
fontsans.ta_Flags = 0;
fontserif.ta_Flags = 0;
fontmono.ta_Flags = 0;
fontcursive.ta_Flags = 0;
fontfantasy.ta_Flags = 0;
+ fontunicode.ta_Flags = 0;
if(!gow)
{
@@ -893,6 +899,15 @@
GetFontEnd,
CHILD_Label, LabelObject,
LABEL_Text, gadlab[GID_OPTS_FONT_FANTASY],
+ LabelEnd,
+ LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_UNICODE] = GetFontObject,
+ GA_ID, GID_OPTS_FONT_UNICODE,
+ GA_RelVerify, TRUE,
+ GETFONT_TextAttr, &fontunicode,
+ GETFONT_OTagOnly, TRUE,
+ GetFontEnd,
+ CHILD_Label, LabelObject,
+ LABEL_Text, gadlab[GID_OPTS_FONT_UNICODE],
LabelEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_DEFAULT] = ChooserObject,
GA_ID, GID_OPTS_FONT_DEFAULT,
@@ -1473,6 +1488,12 @@
if(dot = strrchr(tattr->ta_Name,'.')) *dot = '\0';
option_font_fantasy = (char *)strdup((char *)tattr->ta_Name);
+ GetAttr(GETFONT_TextAttr,gow->objects[GID_OPTS_FONT_UNICODE],(ULONG *)&data);
+ tattr = (struct TextAttr *)data;
+ if(option_font_unicode) free(option_font_unicode);
+ if(dot = strrchr(tattr->ta_Name,'.')) *dot = '\0';
+ option_font_unicode = (char *)strdup((char *)tattr->ta_Name);
+
GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_FONT_DEFAULT],(ULONG *)&option_font_default);
option_font_default += PLOT_FONT_FAMILY_SANS_SERIF;
@@ -1741,6 +1762,11 @@
GFONT_REQUEST,gow->win);
break;
+ case GID_OPTS_FONT_UNICODE:
+ IDoMethod(gow->objects[GID_OPTS_FONT_UNICODE],
+ GFONT_REQUEST,gow->win);
+ break;
+
case GID_OPTS_DLDIR:
IDoMethod(gow->objects[GID_OPTS_DLDIR],
GFILE_REQUEST,gow->win);
Modified: trunk/netsurf/amiga/options.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/options.h?rev=10551...
==============================================================================
--- trunk/netsurf/amiga/options.h (original)
+++ trunk/netsurf/amiga/options.h Thu May 6 05:02:58 2010
@@ -48,6 +48,7 @@
extern bool option_startup_no_window;
extern bool option_close_no_quit;
extern bool option_hide_docky_icon;
+extern char *option_font_unicode;
#define EXTRA_OPTION_DEFINE \
char *option_url_file = 0; \
@@ -78,6 +79,7 @@
bool option_startup_no_window = false; \
bool option_close_no_quit = false; \
bool option_hide_docky_icon = false; \
+char *option_font_unicode = 0; \
#define EXTRA_OPTION_TABLE \
{ "url_file", OPTION_STRING, &option_url_file }, \
@@ -107,5 +109,6 @@
{ "print_scale", OPTION_INTEGER, &option_print_scale}, \
{ "startup_no_window", OPTION_BOOL, &option_startup_no_window}, \
{ "close_no_quit", OPTION_BOOL, &option_close_no_quit}, \
-{ "hide_docky_icon", OPTION_BOOL, &option_hide_docky_icon},
+{ "hide_docky_icon", OPTION_BOOL, &option_hide_docky_icon}, \
+{ "font_unicode", OPTION_STRING, &option_font_unicode },
#endif
13 years, 4 months
r10550 vince - in /trunk/netsurf/framebuffer: fbtk.c fbtk.h fbtk_widget.h fbtk_widget_scroll.c gui.c
by netsurf@semichrome.net
Author: vince
Date: Tue May 4 17:41:58 2010
New Revision: 10550
URL: http://source.netsurf-browser.org?rev=10550&view=rev
Log:
rationalise callback routines to use a unified interface
Modified:
trunk/netsurf/framebuffer/fbtk.c
trunk/netsurf/framebuffer/fbtk.h
trunk/netsurf/framebuffer/fbtk_widget.h
trunk/netsurf/framebuffer/fbtk_widget_scroll.c
trunk/netsurf/framebuffer/gui.c
Modified: trunk/netsurf/framebuffer/fbtk.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fbtk.c?rev=10...
==============================================================================
--- trunk/netsurf/framebuffer/fbtk.c (original)
+++ trunk/netsurf/framebuffer/fbtk.c Tue May 4 17:41:58 2010
@@ -230,10 +230,11 @@
}
static void
-fbtk_redraw_widget(fbtk_widget_t *root, fbtk_widget_t *widget)
+fbtk_redraw_widget(fbtk_widget_t *widget)
{
nsfb_bbox_t saved_plot_ctx;
nsfb_bbox_t plot_ctx;
+ fbtk_widget_t *root = get_root_widget(widget);
//LOG(("widget %p type %d", widget, widget->type));
if (widget->redraw_required == false)
@@ -242,7 +243,7 @@
widget->redraw_required = false;
/* ensure there is a redraw handler */
- if (widget->redraw == NULL)
+ if (fbtk_get_handler(widget, FBTK_CBT_REDRAW) == NULL)
return;
/* get the current clipping rectangle */
@@ -258,8 +259,7 @@
nsfb_plot_set_clip(root->u.root.fb, &plot_ctx);
- /* do our drawing according to type */
- widget->redraw(root, widget, widget->redrawpw);
+ fbtk_post_callback(widget, FBTK_CBT_REDRAW);
/* restore clipping rectangle */
nsfb_plot_set_clip(root->u.root.fb, &saved_plot_ctx);
@@ -272,9 +272,11 @@
/*************** redraw widgets **************/
static int
-fb_redraw_fill(fbtk_widget_t *root, fbtk_widget_t *widget, void *pw)
+fb_redraw_fill(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
nsfb_bbox_t bbox;
+ fbtk_widget_t *root = get_root_widget(widget);
+
fbtk_get_bbox(widget, &bbox);
nsfb_claim(root->u.root.fb, &bbox);
@@ -292,10 +294,11 @@
static int
-fb_redraw_bitmap(fbtk_widget_t *root, fbtk_widget_t *widget, void *pw)
+fb_redraw_bitmap(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
nsfb_bbox_t bbox;
nsfb_bbox_t rect;
+ fbtk_widget_t *root = get_root_widget(widget);
fbtk_get_bbox(widget, &bbox);
@@ -310,7 +313,13 @@
}
/* plot the image */
- nsfb_plot_bitmap(root->u.root.fb, &rect, (nsfb_colour_t *)widget->u.bitmap.bitmap->pixdata, widget->u.bitmap.bitmap->width, widget->u.bitmap.bitmap->height, widget->u.bitmap.bitmap->width, !widget->u.bitmap.bitmap->opaque);
+ nsfb_plot_bitmap(root->u.root.fb,
+ &rect,
+ (nsfb_colour_t *)widget->u.bitmap.bitmap->pixdata,
+ widget->u.bitmap.bitmap->width,
+ widget->u.bitmap.bitmap->height,
+ widget->u.bitmap.bitmap->width,
+ !widget->u.bitmap.bitmap->opaque);
nsfb_update(root->u.root.fb, &bbox);
@@ -318,26 +327,23 @@
}
static int
-fbtk_window_default_redraw(fbtk_widget_t *root, fbtk_widget_t *window, void *pw)
+fbtk_window_default_redraw(fbtk_widget_t *window, fbtk_callback_info *cbi)
{
fbtk_widget_list_t *lent;
int res = 0;
- if (!window->redraw)
- return res;
-
/* get the list of widgets */
lent = window->u.window.widgets;
while (lent != NULL) {
- fbtk_redraw_widget(root, lent->widget);
+ fbtk_redraw_widget(lent->widget);
lent = lent->next;
}
return res;
}
static int
-fbtk_window_default_move(fbtk_widget_t *window, int x, int y, void *pw)
+fbtk_window_default_move(fbtk_widget_t *window, fbtk_callback_info *cbi)
{
fbtk_widget_list_t *lent;
fbtk_widget_t *widget;
@@ -349,16 +355,14 @@
while (lent != NULL) {
widget = lent->widget;
- if ((x > widget->x) &&
- (y > widget->y) &&
- (x < widget->x + widget->width) &&
- (y < widget->y + widget->height)) {
- if (widget->move != NULL) {
- res = widget->move(widget,
- x - widget->x,
- y - widget->y,
- widget->movepw);
- }
+ if ((cbi->x > widget->x) &&
+ (cbi->y > widget->y) &&
+ (cbi->x < widget->x + widget->width) &&
+ (cbi->y < widget->y + widget->height)) {
+ res = fbtk_post_callback(widget,
+ FBTK_CBT_POINTERMOVE,
+ cbi->x - widget->x,
+ cbi->y - widget->y);
break;
}
lent = lent->prev;
@@ -367,7 +371,7 @@
}
static int
-fbtk_window_default_click(fbtk_widget_t *window, nsfb_event_t *event, int x, int y, void *pw)
+fbtk_window_default_click(fbtk_widget_t *window, fbtk_callback_info *cbi)
{
fbtk_widget_list_t *lent;
fbtk_widget_t *widget;
@@ -379,25 +383,22 @@
while (lent != NULL) {
widget = lent->widget;
- if ((x > widget->x) &&
- (y > widget->y) &&
- (x < widget->x + widget->width) &&
- (y < widget->y + widget->height)) {
- if (widget->input != NULL) {
+ if ((cbi->x > widget->x) &&
+ (cbi->y > widget->y) &&
+ (cbi->x < widget->x + widget->width) &&
+ (cbi->y < widget->y + widget->height)) {
+ if (fbtk_get_handler(widget, FBTK_CBT_INPUT) != NULL) {
fbtk_widget_t *root = get_root_widget(widget);
root->u.root.input = widget;
}
- if (widget->click != NULL) {
- res = widget->click(widget,
- event,
- x - widget->x,
- y - widget->y,
- widget->clickpw);
- break;
- }
-
-
+ res = fbtk_post_callback(widget,
+ FBTK_CBT_CLICK,
+ cbi->event,
+ cbi->x - widget->x,
+ cbi->y - widget->y);
+ if (res != 0)
+ break;
}
lent = lent->next;
@@ -406,10 +407,11 @@
}
static int
-fb_redraw_text(fbtk_widget_t *root, fbtk_widget_t *widget, void *pw)
+fb_redraw_text(fbtk_widget_t *widget, fbtk_callback_info *cbi )
{
nsfb_bbox_t bbox;
nsfb_bbox_t rect;
+ fbtk_widget_t *root = get_root_widget(widget);
fbtk_get_bbox(widget, &bbox);
@@ -450,10 +452,10 @@
static int
-text_input(fbtk_widget_t *widget, nsfb_event_t *event, void *pw)
+text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
int value;
- if (event == NULL) {
+ if (cbi->event == NULL) {
/* gain focus */
if (widget->u.text.text == NULL)
widget->u.text.text = calloc(1,1);
@@ -462,13 +464,12 @@
fbtk_request_redraw(widget);
return 0;
-
- }
-
- if (event->type != NSFB_EVENT_KEY_DOWN)
+ }
+
+ if (cbi->event->type != NSFB_EVENT_KEY_DOWN)
return 0;
- value = event->value.keycode;
+ value = cbi->event->value.keycode;
switch (value) {
case NSFB_KEY_BACKSPACE:
if (widget->u.text.idx <= 0)
@@ -501,8 +502,7 @@
if (temp != NULL) {
widget->u.text.text = temp;
widget->u.text.text[widget->u.text.idx] = value;
- widget->u.text.text[widget->u.text.idx + 1] =
- '\0';
+ widget->u.text.text[widget->u.text.idx + 1] = '\0';
widget->u.text.idx++;
}
}
@@ -521,8 +521,7 @@
widget->u.text.enter = enter;
widget->u.text.pw = pw;
- widget->input = text_input;
- widget->inputpw = widget;
+ fbtk_set_handler(widget, FBTK_CBT_INPUT, text_input, widget);
}
@@ -585,33 +584,38 @@
return true;
}
-void
-fbtk_set_handler_click(fbtk_widget_t *widget, fbtk_mouseclick_t click, void *pw)
-{
- widget->click = click;
- widget->clickpw = pw;
-}
-
-void
-fbtk_set_handler_input(fbtk_widget_t *widget, fbtk_input_t input, void *pw)
-{
- widget->input = input;
- widget->inputpw = pw;
-}
-
-void
-fbtk_set_handler_redraw(fbtk_widget_t *widget, fbtk_redraw_t redraw, void *pw)
-{
- widget->redraw = redraw;
- widget->redrawpw = pw;
-}
-
-void
-fbtk_set_handler_move(fbtk_widget_t *widget, fbtk_move_t move, void *pw)
-{
- widget->move = move;
- widget->movepw = pw;
-}
+fbtk_callback
+fbtk_get_handler(fbtk_widget_t *widget, fbtk_callback_type cbt)
+{
+ if ((cbt <= FBTK_CBT_START) || (cbt >= FBTK_CBT_END)) {
+ /* type out of range, no way to report error so return NULL */
+ return NULL;
+ }
+
+ return widget->callback[cbt];
+}
+
+fbtk_callback
+fbtk_set_handler(fbtk_widget_t *widget,
+ fbtk_callback_type cbt,
+ fbtk_callback cb,
+ void *context)
+{
+ fbtk_callback prevcb;
+
+ if ((cbt <= FBTK_CBT_START) || (cbt >= FBTK_CBT_END)) {
+ /* type out of range, no way to report error so return NULL */
+ return NULL;
+ }
+
+ prevcb = widget->callback[cbt];
+
+ widget->callback[cbt] = cb;
+ widget->callback_context[cbt] = context;
+
+ return prevcb;
+}
+
void *
fbtk_get_userpw(fbtk_widget_t *widget)
@@ -701,18 +705,13 @@
if (input == NULL)
return; /* no widget with input */
- if (input->input == NULL)
- return;
-
- /* call the widgets input method */
- input->input(input, event, input->inputpw);
+ fbtk_post_callback(input, FBTK_CBT_INPUT, event);
}
void
fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event)
{
fbtk_widget_t *root;
- fbtk_widget_t *window;
nsfb_bbox_t cloc;
/* ensure we have the root widget */
@@ -720,11 +719,9 @@
nsfb_cursor_loc_get(root->u.root.fb, &cloc);
- /* get the root window */
- window = root->u.root.rootw;
- LOG(("click %d, %d",cloc.x0,cloc.y0));
- if (window->click != NULL)
- window->click(window, event, cloc.x0, cloc.y0, window->clickpw);
+
+ /* post the click */
+ fbtk_post_callback(root->u.root.rootw, FBTK_CBT_CLICK, event, cloc.x0, cloc.y0);
}
@@ -733,7 +730,6 @@
fbtk_move_pointer(fbtk_widget_t *widget, int x, int y, bool relative)
{
fbtk_widget_t *root;
- fbtk_widget_t *window;
nsfb_bbox_t cloc;
/* ensure we have the root widget */
@@ -750,13 +746,11 @@
root->redraw_required = true;
+ /* update the pointer cursor */
nsfb_cursor_loc_set(root->u.root.fb, &cloc);
- /* get the root window */
- window = root->u.root.rootw;
-
- if (window->move != NULL)
- window->move(window, cloc.x0, cloc.y0, window->movepw);
+ /* post the movement */
+ fbtk_post_callback(root->u.root.rootw, FBTK_CBT_POINTERMOVE, cloc.x0, cloc.y0);
}
@@ -782,7 +776,7 @@
if (!root->redraw_required)
return 0;
- fbtk_redraw_widget(root, root->u.root.rootw);
+ fbtk_post_callback(root->u.root.rootw, FBTK_CBT_REDRAW);
widget->redraw_required = false;
@@ -822,7 +816,7 @@
newt->fg = fg;
newt->bg = bg;
- newt->redraw = fb_redraw_text;
+ fbtk_set_handler(newt, FBTK_CBT_REDRAW, fb_redraw_text, NULL);
return add_widget_to_window(window, newt);
}
@@ -840,7 +834,7 @@
newb->u.bitmap.bitmap = image;
- newb->redraw = fb_redraw_bitmap;
+ fbtk_set_handler(newb, FBTK_CBT_REDRAW, fb_redraw_bitmap, NULL);
return add_widget_to_window(window, newb);
}
@@ -882,25 +876,39 @@
neww->bg = c;
- neww->redraw = fb_redraw_fill;
+ fbtk_set_handler(neww, FBTK_CBT_REDRAW, fb_redraw_fill, NULL);
return add_widget_to_window(window, neww);
}
-
+/* set pointer to bitmap in context on cursor move */
+static int
+fbtk_set_ptr_move(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ fbtk_widget_t *root = get_root_widget(widget);
+ struct bitmap *bm = cbi->context;
+
+ nsfb_cursor_set(root->u.root.fb,
+ (nsfb_colour_t *)bm->pixdata,
+ bm->width,
+ bm->height,
+ bm->width);
+
+ return 0;
+}
fbtk_widget_t *
fbtk_create_button(fbtk_widget_t *window,
int x, int y,
colour c,
struct bitmap *image,
- fbtk_mouseclick_t click,
+ fbtk_callback click,
void *pw)
{
fbtk_widget_t *newb = fbtk_create_bitmap(window, x, y, c, image);
- newb->click = click;
- newb->clickpw = pw;
+ fbtk_set_handler(newb, FBTK_CBT_CLICK, click, pw);
+ fbtk_set_handler(newb, FBTK_CBT_POINTERMOVE, fbtk_set_ptr_move, &hand_image);
return newb;
}
@@ -917,8 +925,8 @@
newt->u.text.enter = enter;
newt->u.text.pw = pw;
- newt->input = text_input;
- newt->inputpw = newt;
+ fbtk_set_handler(newt, FBTK_CBT_INPUT, text_input, newt);
+
return newt;
}
@@ -1011,13 +1019,66 @@
newwin->width = width;
newwin->height = height;
- newwin->redraw = fbtk_window_default_redraw;
- newwin->move = fbtk_window_default_move;
- newwin->click = fbtk_window_default_click;
-
+ fbtk_set_handler(newwin, FBTK_CBT_REDRAW, fbtk_window_default_redraw, NULL);
+ fbtk_set_handler(newwin, FBTK_CBT_POINTERMOVE, fbtk_window_default_move, NULL);
+ fbtk_set_handler(newwin, FBTK_CBT_CLICK, fbtk_window_default_click, NULL);
LOG(("Created window %p %d,%d %d,%d",newwin,x,y,width,height));
return add_widget_to_window(parent, newwin);
+}
+
+int
+fbtk_post_callback(fbtk_widget_t *widget, fbtk_callback_type cbt, ...)
+{
+ fbtk_callback_info cbi;
+ int ret = 0;
+ va_list ap;
+
+ if (widget->callback[cbt] != NULL) {
+ cbi.type = cbt;
+ cbi.context = widget->callback_context[cbt];
+
+ va_start(ap, cbt);
+
+ switch (cbt) {
+ case FBTK_CBT_SCROLLX:
+ cbi.x = va_arg(ap,int);
+ break;
+
+ case FBTK_CBT_SCROLLY:
+ cbi.y = va_arg(ap,int);
+ break;
+
+ case FBTK_CBT_CLICK:
+ cbi.event = va_arg(ap, void *);
+ cbi.x = va_arg(ap, int);
+ cbi.y = va_arg(ap, int);
+ break;
+
+ case FBTK_CBT_INPUT:
+ cbi.event = va_arg(ap, void *);
+ break;
+
+ case FBTK_CBT_POINTERMOVE:
+ cbi.x = va_arg(ap, int);
+ cbi.y = va_arg(ap, int);
+ break;
+
+ case FBTK_CBT_REDRAW:
+ break;
+
+ case FBTK_CBT_USER:
+ break;
+
+ default:
+ break;
+ }
+ va_end(ap);
+
+ ret = (widget->callback[cbt])(widget, &cbi);
+ }
+
+ return ret;
}
bool fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
Modified: trunk/netsurf/framebuffer/fbtk.h
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fbtk.h?rev=10...
==============================================================================
--- trunk/netsurf/framebuffer/fbtk.h (original)
+++ trunk/netsurf/framebuffer/fbtk.h Tue May 4 17:41:58 2010
@@ -27,23 +27,26 @@
typedef struct fbtk_widget_s fbtk_widget_t;
-enum fbtk_callback_info_type {
- FBTK_CBIT_SCROLLX = 0,
- FBTK_CBIT_SCROLLY,
- FBTK_CBIT_CLICK,
- FBTK_CBIT_INPUT,
- FBTK_CBIT_MOVE,
- FBTK_CBIT_REDRAW,
- FBTK_CBIT_END,
-};
+typedef enum fbtk_callback_type {
+ FBTK_CBT_START = 0,
+ FBTK_CBT_SCROLLX,
+ FBTK_CBT_SCROLLY,
+ FBTK_CBT_CLICK,
+ FBTK_CBT_INPUT,
+ FBTK_CBT_POINTERMOVE,
+ FBTK_CBT_REDRAW,
+ FBTK_CBT_USER,
+ FBTK_CBT_END,
+} fbtk_callback_type;
typedef struct fbtk_callback_info {
- enum fbtk_callback_info_type type;
+ enum fbtk_callback_type type;
void *context;
nsfb_event_t *event;
int x;
int y;
char *text;
+ fbtk_widget_t *widget;
} fbtk_callback_info;
typedef int (*fbtk_callback)(fbtk_widget_t *widget, fbtk_callback_info *cbi);
@@ -52,21 +55,13 @@
/* user widget callback */
typedef int (*fbtk_user_t)(fbtk_widget_t *widget, void *pw);
-/* input callback */
-typedef int (*fbtk_input_t)(fbtk_widget_t *widget, nsfb_event_t *event, void *pw);
-
-/* mouse click callback */
-typedef int (*fbtk_mouseclick_t)(fbtk_widget_t *widget, nsfb_event_t *event, int x, int y, void *pw);
-
-/* mouse move callback */
-typedef int (*fbtk_move_t)(fbtk_widget_t *widget, int x, int y, void *pw);
-
-/* redraw function */
-typedef int (*fbtk_redraw_t)(fbtk_widget_t *root, fbtk_widget_t *widget, void *pw);
/* enter pressed on writable icon */
typedef int (*fbtk_enter_t)(void *pw, char *text);
+
+/* helper function to allow simple method to call callbacks */
+int fbtk_post_callback(fbtk_widget_t *widget, fbtk_callback_type cbt, ...);
/* Widget creation */
@@ -160,7 +155,7 @@
* @param window The window to add the button widget to.
* @return new widget handle or NULL on error.
*/
-fbtk_widget_t *fbtk_create_button(fbtk_widget_t *window, int x, int y, colour c, struct bitmap *image, fbtk_mouseclick_t click, void *pw);
+fbtk_widget_t *fbtk_create_button(fbtk_widget_t *window, int x, int y, colour c, struct bitmap *image, fbtk_callback click, void *pw);
/** Create a writable text widget.
*
@@ -199,10 +194,13 @@
void fbtk_set_scroll(fbtk_widget_t *widget, int pct);
void fbtk_set_scroll_pos(fbtk_widget_t *widget, int pos);
void fbtk_set_pos_and_size(fbtk_widget_t *widget, int x, int y, int width, int height);
-void fbtk_set_handler_redraw(fbtk_widget_t *widget, fbtk_redraw_t input, void *pw);
-void fbtk_set_handler_input(fbtk_widget_t *widget, fbtk_input_t input, void *pw);
-void fbtk_set_handler_click(fbtk_widget_t *widget, fbtk_mouseclick_t click, void *pw);
-void fbtk_set_handler_move(fbtk_widget_t *widget, fbtk_move_t move, void *pw);
+;
+
+/** Set a callback handler */
+fbtk_callback fbtk_set_handler(fbtk_widget_t *widget, fbtk_callback_type cbt, fbtk_callback cb, void *pw);
+
+/** Get a callback handler */
+fbtk_callback fbtk_get_handler(fbtk_widget_t *widget, fbtk_callback_type cbt);
/** Alter a text widget to be writable.
*/
Modified: trunk/netsurf/framebuffer/fbtk_widget.h
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fbtk_widget.h...
==============================================================================
--- trunk/netsurf/framebuffer/fbtk_widget.h (original)
+++ trunk/netsurf/framebuffer/fbtk_widget.h Tue May 4 17:41:58 2010
@@ -42,25 +42,13 @@
colour bg;
colour fg;
- /* handlers */
- fbtk_mouseclick_t click;
- void *clickpw; /* private data for callback */
+ /* event callback handlers */
+ fbtk_callback callback[FBTK_CBT_END];
+ void *callback_context[FBTK_CBT_END];
- fbtk_input_t input;
- void *inputpw; /* private data for callback */
-
- fbtk_move_t move;
- void *movepw; /* private data for callback */
-
- fbtk_redraw_t redraw;
- void *redrawpw; /* private data for callback */
-
- bool redraw_required;
+ bool redraw_required; /* the widget requires redrawing */
fbtk_widget_t *parent; /* parent widget */
-
- fbtk_callback callback; /* event callback */
- void *callback_context;
/* Widget specific */
enum fbtk_widgettype_e type;
Modified: trunk/netsurf/framebuffer/fbtk_widget_scroll.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fbtk_widget_s...
==============================================================================
--- trunk/netsurf/framebuffer/fbtk_widget_scroll.c (original)
+++ trunk/netsurf/framebuffer/fbtk_widget_scroll.c Tue May 4 17:41:58 2010
@@ -37,13 +37,14 @@
/** Vertical scroll widget */
static int
-vscroll_redraw(fbtk_widget_t *root, fbtk_widget_t *widget, void *pw)
+vscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
int vscroll;
int vpos;
nsfb_bbox_t bbox;
nsfb_bbox_t rect;
+ fbtk_widget_t *root = get_root_widget(widget);
fbtk_get_bbox(widget, &bbox);
@@ -82,85 +83,46 @@
}
static int
-vscrollu_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y, void *pw)
-{
- fbtk_widget_t *scrollw = pw;
- fbtk_callback_info cbi;
-
- if (event->type != NSFB_EVENT_KEY_DOWN)
- return 0;
-
- cbi.type = FBTK_CBIT_SCROLLY;
- cbi.context = scrollw->callback_context;
- cbi.y = -1;
-
- return (scrollw->callback)(scrollw, &cbi);
-}
-
-static int
-vscrolld_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y, void *pw)
-{
- fbtk_widget_t *scrollw = pw;
- fbtk_callback_info cbi;
-
- if (event->type != NSFB_EVENT_KEY_DOWN)
- return 0;
-
- cbi.type = FBTK_CBIT_SCROLLY;
- cbi.context = scrollw->callback_context;
- cbi.y = 1;
-
- return (scrollw->callback)(scrollw, &cbi);
-}
-
-static int
-vscrollarea_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y, void *pw)
-{
- fbtk_widget_t *scrollw = pw;
- fbtk_callback_info cbi;
+vscrollu_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ int ret = 0;
+ if (cbi->event->type == NSFB_EVENT_KEY_DOWN)
+ ret = fbtk_post_callback(cbi->context, FBTK_CBT_SCROLLY, -1);
+ return ret;
+}
+
+static int
+vscrolld_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ int ret = 0;
+ if (cbi->event->type == NSFB_EVENT_KEY_DOWN)
+ ret = fbtk_post_callback(cbi->context, FBTK_CBT_SCROLLY, 1);
+ return ret;
+}
+
+static int
+vscrollarea_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
int vscroll;
int vpos;
-
- if (event->type != NSFB_EVENT_KEY_DOWN)
+ int ret = 0;
+
+ if (cbi->event->type != NSFB_EVENT_KEY_DOWN)
return 0;
vscroll = ((widget->height - 4) * widget->u.scroll.pct) / 100 ;
vpos = ((widget->height - 4) * widget->u.scroll.pos) / 100 ;
- cbi.type = FBTK_CBIT_SCROLLY;
- cbi.context = scrollw->callback_context;
- if (y < vpos) {
+ if (cbi->y < vpos) {
/* above bar */
- cbi.y = -1;
- return (scrollw->callback)(scrollw, &cbi);
- } else if (y > (vpos+vscroll)) {
+ ret = fbtk_post_callback(cbi->context, FBTK_CBT_SCROLLY, -1);
+ } else if (cbi->y > (vpos + vscroll)) {
/* below bar */
- cbi.y = 1;
- return (scrollw->callback)(scrollw, &cbi);
+ ret = fbtk_post_callback(cbi->context, FBTK_CBT_SCROLLY, 1);
}
- return 0;
-}
-
-static int
-set_ptr_hand_move(fbtk_widget_t *widget,
- int x, int y,
- void *pw)
-{
- fbtk_widget_t *root = get_root_widget(widget);
- nsfb_cursor_set(root->u.root.fb,
- (nsfb_colour_t *)hand_image.pixdata,
- hand_image.width,
- hand_image.height,
- hand_image.width);
-
- return 0;
-}
+ return ret;
+}
+
fbtk_widget_t *
fbtk_create_vscroll(fbtk_widget_t *window,
@@ -180,19 +142,15 @@
neww->fg = fg;
neww->bg = bg;
- neww->redraw = vscroll_redraw;
-
- neww->click = vscrollarea_click;
- neww->clickpw = neww;
-
- neww->callback = callback;
- neww->callback_context = context;
+ fbtk_set_handler(neww, FBTK_CBT_REDRAW, vscroll_redraw, NULL);
+
+ fbtk_set_handler(neww, FBTK_CBT_CLICK, vscrollarea_click, neww);
+
+ fbtk_set_handler(neww, FBTK_CBT_SCROLLY, callback, context);
neww->u.scroll.btnul = fbtk_create_button(window, x + (width - scrollu.width) / 2, y, fg, &scrollu, vscrollu_click, neww);
- fbtk_set_handler_move(neww->u.scroll.btnul, set_ptr_hand_move, NULL);
neww->u.scroll.btndr = fbtk_create_button(window, x + (width - scrolld.width) / 2, y + height - scrolld.height, fg, &scrolld, vscrolld_click, neww);
- fbtk_set_handler_move(neww->u.scroll.btndr, set_ptr_hand_move, NULL);
return add_widget_to_window(window, neww);
@@ -201,12 +159,13 @@
/* Horizontal scroll widget */
static int
-hscroll_redraw(fbtk_widget_t *root, fbtk_widget_t *widget, void *pw)
+hscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
int hscroll;
int hpos;
nsfb_bbox_t bbox;
nsfb_bbox_t rect;
+ fbtk_widget_t *root = get_root_widget(widget);
fbtk_get_bbox(widget, &bbox);
@@ -245,69 +204,44 @@
}
static int
-hscrolll_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y, void *pw)
-{
- fbtk_widget_t *scrollw = pw;
- fbtk_callback_info cbi;
-
- if (event->type != NSFB_EVENT_KEY_DOWN)
- return 0;
-
- cbi.type = FBTK_CBIT_SCROLLX;
- cbi.context = scrollw->callback_context;
- cbi.x = -1;
-
- return (scrollw->callback)(scrollw, &cbi);
-}
-
-static int
-hscrollr_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y, void *pw)
-{
- fbtk_widget_t *scrollw = pw;
- fbtk_callback_info cbi;
-
- if (event->type != NSFB_EVENT_KEY_DOWN)
- return 0;
-
- cbi.type = FBTK_CBIT_SCROLLX;
- cbi.context = scrollw->callback_context;
- cbi.x = 1;
-
- return (scrollw->callback)(scrollw, &cbi);
-}
-
-static int
-hscrollarea_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y, void *pw)
-{
- fbtk_widget_t *scrollw = pw;
- fbtk_callback_info cbi;
+hscrolll_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ int ret = 0;
+ if (cbi->event->type == NSFB_EVENT_KEY_DOWN)
+ ret = fbtk_post_callback(cbi->context, FBTK_CBT_SCROLLX, -1);
+ return ret;
+}
+
+static int
+hscrollr_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ int ret = 0;
+ if (cbi->event->type == NSFB_EVENT_KEY_DOWN)
+ ret = fbtk_post_callback(cbi->context, FBTK_CBT_SCROLLX, 1);
+ return ret;
+}
+
+static int
+hscrollarea_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
int hscroll;
int hpos;
-
- if (event->type != NSFB_EVENT_KEY_DOWN)
+ int ret;
+
+ if (cbi->event->type != NSFB_EVENT_KEY_DOWN)
return 0;
hscroll = ((widget->width - 4) * widget->u.scroll.pct) / 100 ;
hpos = ((widget->width - 4) * widget->u.scroll.pos) / 100 ;
- cbi.type = FBTK_CBIT_SCROLLX;
- cbi.context = scrollw->callback_context;
- if (x < hpos) {
+ if (cbi->x < hpos) {
/* above bar */
- cbi.x = -1;
- return (scrollw->callback)(scrollw, &cbi);
- } else if (x > (hpos + hscroll)) {
+ ret = fbtk_post_callback(cbi->context, FBTK_CBT_SCROLLX, -1);
+ } else if (cbi->x > (hpos + hscroll)) {
/* below bar */
- cbi.x = 1;
- return (scrollw->callback)(scrollw, &cbi);
+ ret = fbtk_post_callback(cbi->context, FBTK_CBT_SCROLLX, 1);
}
- return 0;
+ return ret;
}
fbtk_widget_t *
@@ -328,13 +262,9 @@
neww->fg = fg;
neww->bg = bg;
- neww->redraw = hscroll_redraw;
-
- neww->click = hscrollarea_click;
- neww->clickpw = neww;
-
- neww->callback = callback;
- neww->callback_context = context;
+ fbtk_set_handler(neww, FBTK_CBT_REDRAW, hscroll_redraw, NULL);
+ fbtk_set_handler(neww, FBTK_CBT_CLICK, hscrollarea_click, neww);
+ fbtk_set_handler(neww, FBTK_CBT_SCROLLX, callback, context);
neww->u.scroll.btnul = fbtk_create_button(window, x, y + ((height - scrolll.height) / 2), fg, &scrolll, hscrolll_click, neww);
Modified: trunk/netsurf/framebuffer/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/gui.c?rev=105...
==============================================================================
--- trunk/netsurf/framebuffer/gui.c (original)
+++ trunk/netsurf/framebuffer/gui.c Tue May 4 17:41:58 2010
@@ -294,9 +294,9 @@
}
static int
-fb_browser_window_redraw(fbtk_widget_t *root, fbtk_widget_t *widget, void *pw)
-{
- struct gui_window *gw = pw;
+fb_browser_window_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ struct gui_window *gw = cbi->context;
struct browser_widget_s *bwidget;
bwidget = fbtk_get_userpw(widget);
@@ -498,35 +498,32 @@
/* called back when click in browser window */
static int
-fb_browser_window_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y,
- void *pw)
-{
- struct browser_window *bw = pw;
+fb_browser_window_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ struct browser_window *bw = cbi->context;
struct browser_widget_s *bwidget = fbtk_get_userpw(widget);
- if (event->type != NSFB_EVENT_KEY_DOWN &&
- event->type != NSFB_EVENT_KEY_UP)
+ if (cbi->event->type != NSFB_EVENT_KEY_DOWN &&
+ cbi->event->type != NSFB_EVENT_KEY_UP)
return 0;
- LOG(("browser window clicked at %d,%d",x,y));
-
- switch (event->type) {
+ LOG(("browser window clicked at %d,%d",cbi->x,cbi->y));
+
+ switch (cbi->event->type) {
case NSFB_EVENT_KEY_DOWN:
- switch (event->value.keycode) {
+ switch (cbi->event->value.keycode) {
case NSFB_KEY_MOUSE_1:
browser_window_mouse_click(bw,
BROWSER_MOUSE_PRESS_1,
- x + bwidget->scrollx,
- y + bwidget->scrolly);
+ cbi->x + bwidget->scrollx,
+ cbi->y + bwidget->scrolly);
break;
case NSFB_KEY_MOUSE_3:
browser_window_mouse_click(bw,
BROWSER_MOUSE_PRESS_2,
- x + bwidget->scrollx,
- y + bwidget->scrolly);
+ cbi->x + bwidget->scrollx,
+ cbi->y + bwidget->scrolly);
break;
case NSFB_KEY_MOUSE_4:
@@ -546,19 +543,19 @@
break;
case NSFB_EVENT_KEY_UP:
- switch (event->value.keycode) {
+ switch (cbi->event->value.keycode) {
case NSFB_KEY_MOUSE_1:
browser_window_mouse_click(bw,
BROWSER_MOUSE_CLICK_1,
- x + bwidget->scrollx,
- y + bwidget->scrolly);
+ cbi->x + bwidget->scrollx,
+ cbi->y + bwidget->scrolly);
break;
case NSFB_KEY_MOUSE_3:
browser_window_mouse_click(bw,
BROWSER_MOUSE_CLICK_2,
- x + bwidget->scrollx,
- y + bwidget->scrolly);
+ cbi->x + bwidget->scrollx,
+ cbi->y + bwidget->scrolly);
break;
default:
@@ -571,42 +568,38 @@
break;
}
- return 0;
+ return 1;
}
/* called back when movement in browser window */
static int
-fb_browser_window_move(fbtk_widget_t *widget,
- int x, int y,
- void *pw)
-{
- struct browser_window *bw = pw;
+fb_browser_window_move(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ struct browser_window *bw = cbi->context;
struct browser_widget_s *bwidget = fbtk_get_userpw(widget);
browser_window_mouse_track(bw,
0,
- x + bwidget->scrollx,
- y + bwidget->scrolly);
+ cbi->x + bwidget->scrollx,
+ cbi->y + bwidget->scrolly);
return 0;
}
static int
-fb_browser_window_input(fbtk_widget_t *widget,
- nsfb_event_t *event,
- void *pw)
-{
- struct gui_window *gw = pw;
+fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ struct gui_window *gw = cbi->context;
int res = 0;
static uint8_t modifier = 0;
int ucs4 = -1;
- LOG(("got value %d", event->value.keycode));
-
- switch (event->type) {
+ LOG(("got value %d", cbi->event->value.keycode));
+
+ switch (cbi->event->type) {
case NSFB_EVENT_KEY_DOWN:
- switch (event->value.keycode) {
+ switch (cbi->event->value.keycode) {
case NSFB_KEY_PAGEUP:
if (browser_window_key_press(gw->bw, KEY_PAGE_UP) == false)
@@ -647,7 +640,8 @@
break;
default:
- ucs4 = fbtk_keycode_to_ucs4(event->value.keycode, modifier);
+ ucs4 = fbtk_keycode_to_ucs4(cbi->event->value.keycode,
+ modifier);
if (ucs4 != -1)
res = browser_window_key_press(gw->bw, ucs4);
break;
@@ -655,7 +649,7 @@
break;
case NSFB_EVENT_KEY_UP:
- switch (event->value.keycode) {
+ switch (cbi->event->value.keycode) {
case NSFB_KEY_RSHIFT:
modifier &= ~1;
break;
@@ -691,71 +685,60 @@
/* left icon click routine */
static int
-fb_leftarrow_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y, void *pw)
-{
- struct gui_window *gw = pw;
+fb_leftarrow_click(fbtk_widget_t *widget,fbtk_callback_info *cbi)
+{
+ struct gui_window *gw = cbi->context;
struct browser_window *bw = gw->bw;
- if (event->type != NSFB_EVENT_KEY_DOWN)
+ if (cbi->event->type != NSFB_EVENT_KEY_DOWN)
return 0;
if (history_back_available(bw->history))
history_back(bw, bw->history);
fb_update_back_forward(gw);
- return 0;
-
+
+ return 1;
}
/* right arrow icon click routine */
static int
-fb_rightarrow_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y,
- void *pw)
-{
- struct gui_window *gw =pw;
+fb_rightarrow_click(fbtk_widget_t *widget,fbtk_callback_info *cbi)
+{
+ struct gui_window *gw = cbi->context;
struct browser_window *bw = gw->bw;
- if (event->type != NSFB_EVENT_KEY_DOWN)
+ if (cbi->event->type != NSFB_EVENT_KEY_DOWN)
return 0;
if (history_forward_available(bw->history))
history_forward(bw, bw->history);
fb_update_back_forward(gw);
- return 0;
+ return 1;
}
/* reload icon click routine */
static int
-fb_reload_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y,
- void *pw)
-{
- struct browser_window *bw = pw;
-
- if (event->type != NSFB_EVENT_KEY_DOWN)
+fb_reload_click(fbtk_widget_t *widget,fbtk_callback_info *cbi)
+{
+ struct browser_window *bw = cbi->context;
+
+ if (cbi->event->type != NSFB_EVENT_KEY_DOWN)
return 0;
browser_window_reload(bw, true);
- return 0;
+ return 1;
}
/* stop icon click routine */
static int
-fb_stop_click(fbtk_widget_t *widget,
- nsfb_event_t *event,
- int x, int y,
- void *pw)
-{
- struct browser_window *bw = pw;
-
- if (event->type != NSFB_EVENT_KEY_DOWN)
+fb_stop_click(fbtk_widget_t *widget,fbtk_callback_info *cbi)
+{
+ struct browser_window *bw = cbi->context;
+
+ if (cbi->event->type != NSFB_EVENT_KEY_DOWN)
return 0;
browser_window_stop(bw);
@@ -769,11 +752,11 @@
struct gui_window *gw = cbi->context;
switch (cbi->type) {
- case FBTK_CBIT_SCROLLY:
+ case FBTK_CBT_SCROLLY:
fb_window_scroll(gw->browser, 0, 100 * cbi->y);
break;
- case FBTK_CBIT_SCROLLX:
+ case FBTK_CBT_SCROLLX:
fb_window_scroll(gw->browser, 100 * cbi->x, 0);
break;
@@ -792,29 +775,16 @@
}
static int
-fb_url_move(fbtk_widget_t *widget,
- int x, int y,
- void *pw)
+fb_url_move(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
framebuffer_set_cursor(&caret_image);
return 0;
}
static int
-set_ptr_default_move(fbtk_widget_t *widget,
- int x, int y,
- void *pw)
+set_ptr_default_move(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
framebuffer_set_cursor(&pointer_image);
- return 0;
-}
-
-static int
-set_ptr_hand_move(fbtk_widget_t *widget,
- int x, int y,
- void *pw)
-{
- framebuffer_set_cursor(&hand_image);
return 0;
}
@@ -865,14 +835,13 @@
widget = fbtk_create_fill(gw->window,
0, 0, 0, toolbar_height,
FB_FRAME_COLOUR);
- fbtk_set_handler_move(widget, set_ptr_default_move, bw);
+ fbtk_set_handler(widget, FBTK_CBT_POINTERMOVE, set_ptr_default_move, bw);
/* back button */
gw->back = fbtk_create_button(gw->window,
xpos, (toolbar_height - left_arrow.height) / 2,
FB_FRAME_COLOUR, &left_arrow,
fb_leftarrow_click, gw);
- fbtk_set_handler_move(gw->back, set_ptr_hand_move, bw);
xpos += left_arrow.width + spacing_width;
/* forward button */
@@ -880,7 +849,6 @@
xpos, (toolbar_height - right_arrow.height) / 2,
FB_FRAME_COLOUR, &right_arrow,
fb_rightarrow_click, gw);
- fbtk_set_handler_move(gw->forward, set_ptr_hand_move, bw);
xpos += right_arrow.width + spacing_width;
/* reload button */
@@ -888,7 +856,6 @@
xpos, (toolbar_height - stop_image.height) / 2,
FB_FRAME_COLOUR, &stop_image,
fb_stop_click, bw);
- fbtk_set_handler_move(widget, set_ptr_hand_move, bw);
xpos += stop_image.width + spacing_width;
/* reload button */
@@ -896,7 +863,6 @@
xpos, (toolbar_height - reload.height) / 2,
FB_FRAME_COLOUR, &reload,
fb_reload_click, bw);
- fbtk_set_handler_move(widget, set_ptr_hand_move, bw);
xpos += reload.width + spacing_width;
/* url widget */
@@ -909,7 +875,7 @@
url_bar_height,
FB_COLOUR_WHITE, FB_COLOUR_BLACK,
true, fb_url_enter, bw);
- fbtk_set_handler_move(gw->url, fb_url_move, bw);
+ fbtk_set_handler(gw->url, FBTK_CBT_POINTERMOVE, fb_url_move, bw);
xpos += fbtk_get_width(gw->window) - xpos -
spacing_width - throbber0.width;
@@ -928,7 +894,7 @@
statusbar_width, furniture_width,
FB_FRAME_COLOUR, FB_COLOUR_BLACK,
false);
- fbtk_set_handler_move(gw->status, set_ptr_default_move, bw);
+ fbtk_set_handler(gw->status, FBTK_CBT_POINTERMOVE, set_ptr_default_move, bw);
/* create horizontal scrollbar */
gw->hscroll = fbtk_create_hscroll(gw->window,
@@ -948,7 +914,7 @@
furniture_width,
furniture_width,
FB_FRAME_COLOUR);
- fbtk_set_handler_move(widget, set_ptr_default_move, bw);
+ fbtk_set_handler(widget, FBTK_CBT_POINTERMOVE, set_ptr_default_move, bw);
/* create vertical scrollbar */
gw->vscroll = fbtk_create_vscroll(gw->window,
@@ -979,10 +945,10 @@
gw->browser = fbtk_create_user(gw->window, 0, toolbar_height, -furniture_width, - (furniture_width + toolbar_height), browser_widget);
- fbtk_set_handler_click(gw->browser, fb_browser_window_click, bw);
- fbtk_set_handler_input(gw->browser, fb_browser_window_input, gw);
- fbtk_set_handler_redraw(gw->browser, fb_browser_window_redraw, gw);
- fbtk_set_handler_move(gw->browser, fb_browser_window_move, bw);
+ fbtk_set_handler(gw->browser, FBTK_CBT_REDRAW, fb_browser_window_redraw, gw);
+ fbtk_set_handler(gw->browser, FBTK_CBT_INPUT, fb_browser_window_input, gw);
+ fbtk_set_handler(gw->browser, FBTK_CBT_CLICK, fb_browser_window_click, bw);
+ fbtk_set_handler(gw->browser, FBTK_CBT_POINTERMOVE, fb_browser_window_move, bw);
return gw;
}
13 years, 4 months
r10548 chris_y - /trunk/netsurf/amiga/font.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon May 3 15:57:32 2010
New Revision: 10548
URL: http://source.netsurf-browser.org?rev=10548&view=rev
Log:
Fix loops reading too many characters
Modified:
trunk/netsurf/amiga/font.c
Modified: trunk/netsurf/amiga/font.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/font.c?rev=10548&r1...
==============================================================================
--- trunk/netsurf/amiga/font.c (original)
+++ trunk/netsurf/amiga/font.c Mon May 3 15:57:32 2010
@@ -111,7 +111,7 @@
*char_offset = length;
- for(i=0;i<=len;i++)
+ for(i=0;i<len;i++)
{
if (*utf16 < 0xD800 || 0xDFFF < *utf16)
utf16charlen = 1;
@@ -218,7 +218,7 @@
*char_offset = 0;
*actual_x = 0;
- for(i=0;i<=len;i++)
+ for(i=0;i<len;i++)
{
utf8len = utf8_char_byte_length(string+utf8clen);
@@ -348,7 +348,7 @@
dy++;
- for(i=0;i<=len;i++)
+ for(i=0;i<len;i++)
{
if (*utf16 < 0xD800 || 0xDFFF < *utf16)
utf16charlen = 1;
13 years, 4 months
r10547 chris_y - in /trunk/netsurf/amiga: clipboard.c utf8.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon May 3 15:49:15 2010
New Revision: 10547
URL: http://source.netsurf-browser.org?rev=10547&view=rev
Log:
Purge parserutils
Modified:
trunk/netsurf/amiga/clipboard.c
trunk/netsurf/amiga/utf8.c
Modified: trunk/netsurf/amiga/clipboard.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/clipboard.c?rev=105...
==============================================================================
--- trunk/netsurf/amiga/clipboard.c (original)
+++ trunk/netsurf/amiga/clipboard.c Mon May 3 15:49:15 2010
@@ -17,7 +17,6 @@
*/
#include "desktop/gui.h"
-#include <parserutils/charset/mibenum.h>
#include "amiga/iff_cset.h"
#include <proto/iffparse.h>
#include <datatypes/textclass.h>
@@ -31,6 +30,8 @@
#include <proto/datatypes.h>
#include "amiga/bitmap.h"
#include "amiga/iff_dr2d.h"
+#include <proto/diskfont.h>
+#include <diskfont/diskfonttag.h>
struct IFFHandle *iffh = NULL;
@@ -93,7 +94,9 @@
}
else
{
- utf8_from_enc(readbuf,parserutils_charset_mibenum_to_name(cset.CodeSet),rlen,&clip);
+ utf8_from_enc(readbuf,
+ ObtainCharsetInfo(DFCS_NUMBER, cset.CodeSet, DFCS_MIMENAME),
+ rlen, &clip);
}
browser_window_paste_text(g->shared->bw,clip,rlen,true);
Modified: trunk/netsurf/amiga/utf8.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/utf8.c?rev=10547&r1...
==============================================================================
--- trunk/netsurf/amiga/utf8.c (original)
+++ trunk/netsurf/amiga/utf8.c Mon May 3 15:49:15 2010
@@ -19,7 +19,6 @@
#include <sys/types.h>
#include "utils/utf8.h"
#include <proto/exec.h>
-#include <parserutils/charset/mibenum.h>
#include <proto/diskfont.h>
#include <diskfont/diskfonttag.h>
@@ -30,7 +29,7 @@
char *encname;
charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = parserutils_charset_mibenum_to_name(charset);
+ encname = ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
return utf8_to_enc(string,encname,len,result);
}
@@ -75,7 +74,7 @@
char *encname;
charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = parserutils_charset_mibenum_to_name(charset);
+ encname = ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
return utf8_from_enc(string,encname,len,result);
}
13 years, 4 months