diff options
-rw-r--r-- | amiga/Makefile.target | 3 | ||||
-rw-r--r-- | amiga/font.c | 89 | ||||
-rwxr-xr-x | amiga/font.h | 14 | ||||
-rw-r--r-- | amiga/font_bitmap.c | 231 | ||||
-rw-r--r-- | amiga/gui.c | 21 | ||||
-rwxr-xr-x | amiga/gui.h | 6 | ||||
-rw-r--r-- | amiga/menu.c | 70 | ||||
-rw-r--r-- | amiga/options.h | 1 |
8 files changed, 357 insertions, 78 deletions
diff --git a/amiga/Makefile.target b/amiga/Makefile.target index 32e076ca6..215ee097a 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -74,7 +74,8 @@ S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \ sslcert.c gui_options.c print.c theme.c drag.c icon.c libs.c \ datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \ stringview/stringview.c stringview/urlhistory.c rtg.c \ - agclass/amigaguide_class.c fs_backing_store.c os3support.c + agclass/amigaguide_class.c fs_backing_store.c os3support.c \ + font_bitmap.c S_AMIGA := $(addprefix amiga/,$(S_AMIGA)) # This is the final source build list diff --git a/amiga/font.c b/amiga/font.c index 435e75992..f930f77d6 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -152,34 +152,16 @@ lwc_string *glypharray[0xffff + 1]; ULONG ami_devicedpi; ULONG ami_xdpi; -int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, +static int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, uint16 *char1, uint16 *char2, uint32 x, uint32 y, uint32 emwidth, bool aa); -int32 ami_font_width_glyph(struct OutlineFont *ofont, +static int32 ami_font_width_glyph(struct OutlineFont *ofont, const uint16 *char1, const uint16 *char2, uint32 emwidth); -struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle, +static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle, const uint16 *codepoint); static void ami_font_cleanup(struct MinList *ami_font_list); -static bool nsfont_width(const plot_font_style_t *fstyle, - const char *string, size_t length, - int *width); - -static bool nsfont_position_in_string(const plot_font_style_t *fstyle, - const char *string, size_t length, - int x, size_t *char_offset, int *actual_x); - -static bool nsfont_split(const plot_font_style_t *fstyle, - const char *string, size_t length, - int x, size_t *char_offset, int *actual_x); - -const struct font_functions nsfont = { - nsfont_width, - nsfont_position_in_string, - nsfont_split -}; - -bool nsfont_width(const plot_font_style_t *fstyle, +static inline bool amiga_nsfont_width(const plot_font_style_t *fstyle, const char *string, size_t length, int *width) { @@ -202,7 +184,7 @@ bool nsfont_width(const plot_font_style_t *fstyle, * \return true on success, false on error and error reported */ -bool nsfont_position_in_string(const plot_font_style_t *fstyle, +static inline bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { @@ -289,7 +271,7 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle, * Returning char_offset == length means no split possible */ -bool nsfont_split(const plot_font_style_t *fstyle, +static inline bool amiga_nsfont_split(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { @@ -428,7 +410,7 @@ static struct ami_font_node *ami_font_open(const char *font) * \param codepoint 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, +static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle, const uint16 *codepoint) { struct ami_font_node *node; @@ -567,7 +549,7 @@ struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle, return NULL; } -int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, +static int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, uint16 *char1, uint16 *char2, uint32 x, uint32 y, uint32 emwidth, bool aa) { struct GlyphMap *glyph; @@ -658,7 +640,7 @@ int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, return char_advance; } -int32 ami_font_width_glyph(struct OutlineFont *ofont, +static int32 ami_font_width_glyph(struct OutlineFont *ofont, const uint16 *char1, const uint16 *char2, uint32 emwidth) { int32 char_advance = 0; @@ -752,6 +734,10 @@ ULONG ami_unicode_text(struct RastPort *rp, const char *string, ULONG length, if(!string || string[0]=='\0') return 0; if(!length) return 0; + if(__builtin_expect(nsoption_bool(use_diskfont) == true, 0)) { + return ami_font_bm_text(rp, string, length, fstyle, dx, dy); + } + if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != NSERROR_OK) return 0; outf16 = utf16; if(!(ofont = ami_open_outline_font(fstyle, 0))) return 0; @@ -905,6 +891,11 @@ void ami_font_setdevicedpi(int id) ULONG ydpi = nsoption_int(screen_ydpi); ULONG xdpi = nsoption_int(screen_ydpi); + if(nsoption_bool(use_diskfont) == true) { + LOG(("WARNING: Using diskfont.library for text. Forcing DPI to 72.")); + nsoption_int(screen_ydpi) = 72; + } + browser_set_dpi(nsoption_int(screen_ydpi)); if(id && (nsoption_int(monitor_aspect_x) != 0) && (nsoption_int(monitor_aspect_y) != 0)) @@ -949,3 +940,47 @@ void ami_font_close_disk_font(struct TextFont *tfont) { CloseFont(tfont); } + + +/* Stub entry points */ +static bool nsfont_width(const plot_font_style_t *fstyle, + const char *string, size_t length, + int *width) +{ + if(__builtin_expect(nsoption_bool(use_diskfont) == false, 1)) { + return amiga_nsfont_width(fstyle, string, length, width); + } else { + return amiga_bm_nsfont_width(fstyle, string, length, width); + } +} + +static bool nsfont_position_in_string(const plot_font_style_t *fstyle, + const char *string, size_t length, + int x, size_t *char_offset, int *actual_x) +{ + if(__builtin_expect(nsoption_bool(use_diskfont) == false, 1)) { + return amiga_nsfont_position_in_string(fstyle, string, length, x, + char_offset, actual_x); + } else { + return amiga_bm_nsfont_position_in_string(fstyle, string, length, x, + char_offset, actual_x); + } +} + +static bool nsfont_split(const plot_font_style_t *fstyle, + const char *string, size_t length, + int x, size_t *char_offset, int *actual_x) +{ + if(__builtin_expect(nsoption_bool(use_diskfont) == false, 1)) { + return amiga_nsfont_split(fstyle, string, length, x, char_offset, actual_x); + } else { + return amiga_bm_nsfont_split(fstyle, string, length, x, char_offset, actual_x); + } +} + +const struct font_functions nsfont = { + nsfont_width, + nsfont_position_in_string, + nsfont_split +}; + diff --git a/amiga/font.h b/amiga/font.h index 10137f777..6c600abe4 100755 --- a/amiga/font.h +++ b/amiga/font.h @@ -40,4 +40,18 @@ void ami_font_savescanner(void); /* Simple diskfont functions for graphics.library use (not page rendering) */ struct TextFont *ami_font_open_disk_font(struct TextAttr *tattr); void ami_font_close_disk_font(struct TextFont *tfont); + +/* In font_bitmap.c */ +bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle, + const char *string, size_t length, int *width); +bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, + const char *string, size_t length, + int x, size_t *char_offset, int *actual_x); +bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle, + const char *string, size_t length, + int x, size_t *char_offset, int *actual_x); +ULONG ami_font_bm_text(struct RastPort *rp, const char *string, ULONG length, + const plot_font_style_t *fstyle, ULONG dx, ULONG dy); + #endif + diff --git a/amiga/font_bitmap.c b/amiga/font_bitmap.c new file mode 100644 index 000000000..0b5b7ce85 --- /dev/null +++ b/amiga/font_bitmap.c @@ -0,0 +1,231 @@ +/* + * Copyright 2008 - 2015 Chris Young <chris@unsatisfactorysoftware.co.uk> + * + * 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 "amiga/os3support.h" + +#include <assert.h> + +#include <proto/diskfont.h> +#include <proto/exec.h> +#include <proto/graphics.h> +#include <proto/timer.h> +#include <proto/utility.h> + +#include <graphics/rpattr.h> + +#include "utils/log.h" +#include "utils/utf8.h" +#include "utils/utils.h" +#include "utils/nsoption.h" +#include "desktop/browser.h" +#include "desktop/font.h" +#include "desktop/gui_window.h" + +#include "amiga/font.h" +#include "amiga/gui.h" +#include "amiga/utf8.h" + +static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_style_t *fstyle) +{ + struct TextFont *bmfont = NULL; + struct TextAttr tattr; + char *fontname, *font; + + if(rp == NULL) return NULL; + + switch(fstyle->family) + { + case PLOT_FONT_FAMILY_SANS_SERIF: + fontname = nsoption_charp(font_sans); + break; + case PLOT_FONT_FAMILY_SERIF: + fontname = nsoption_charp(font_serif); + break; + case PLOT_FONT_FAMILY_MONOSPACE: + fontname = nsoption_charp(font_mono); + break; + case PLOT_FONT_FAMILY_CURSIVE: + fontname = nsoption_charp(font_cursive); + break; + case PLOT_FONT_FAMILY_FANTASY: + fontname = nsoption_charp(font_fantasy); + break; + default: + return NULL; + break; + } + + tattr.ta_Style = FS_NORMAL; + + if (fstyle->flags & FONTF_OBLIQUE) + tattr.ta_Style = FSF_ITALIC; + + if (fstyle->flags & FONTF_ITALIC) + tattr.ta_Style = FSF_ITALIC; + + if (fstyle->weight >= 700) + tattr.ta_Style |= FSF_BOLD; + + if((font = ASPrintf("%s.font", fontname))) { + tattr.ta_Name = font; + tattr.ta_YSize = fstyle->size / FONT_SIZE_SCALE; + LOG(("font: %s/%d", tattr.ta_Name, tattr.ta_YSize)); + if((bmfont = OpenDiskFont(&tattr))) { + SetRPAttrs(rp, RPTAG_Font, bmfont, TAG_DONE); + } + FreeVec(font); + } + + return bmfont; +} + +static void ami_font_bm_close(struct TextFont *bmfont) +{ + CloseFont(bmfont); +} + +bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle, + const char *string, size_t length, + int *width) +{ + *width = length; + + if((glob == NULL) || (glob->rp == NULL)) return false; + + struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle); + + if(bmfont == NULL) return false; + +// convert to local charset + *width = TextLength(glob->rp, string, length); + ami_font_bm_close(bmfont); + + return true; +} + +/** + * Find the position in a string where an x coordinate falls. + * + * \param fstyle style for this text + * \param string UTF-8 string to measure + * \param length length of string + * \param x x coordinate to search for + * \param char_offset updated to offset in string of actual_x, [0..length] + * \param actual_x updated to x coordinate of character closest to x + * \return true on success, false on error and error reported + */ + +bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, + const char *string, size_t length, + int x, size_t *char_offset, int *actual_x) +{ + struct TextExtent extent; + struct TextFont *bmfont; + + if((glob == NULL) || (glob->rp == NULL)) return false; + + bmfont = ami_font_bm_open(glob->rp, fstyle); + + if(bmfont == NULL) return false; + + // convert to local charset + *char_offset = TextFit(glob->rp, string, length, + &extent, NULL, 1, x, 32767); + + *actual_x = extent.te_Extent.MaxX; + + ami_font_bm_close(bmfont); + + return true; +} + + +/** + * Find where to split a string to make it fit a width. + * + * \param fstyle style for this text + * \param string UTF-8 string to measure + * \param length length of string + * \param x width available + * \param char_offset updated to offset in string of actual_x, [1..length] + * \param actual_x updated to x coordinate of character closest to x + * \return true on success, false on error and error reported + * + * On exit, char_offset indicates first character after split point. + * + * Note: char_offset of 0 should never be returned. + * + * Returns: + * char_offset giving split point closest to x, where actual_x <= x + * else + * char_offset giving split point closest to x, where actual_x > x + * + * Returning char_offset == length means no split possible + */ + +bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle, + const char *string, size_t length, + int x, size_t *char_offset, int *actual_x) +{ + struct TextExtent extent; + ULONG co; + char *charp; + + if((glob == NULL) || (glob->rp == NULL)) return false; + + struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle); + + if(bmfont == NULL) return false; + + co = TextFit(glob->rp, string, length, + &extent, NULL, 1, x, 32767); + + charp = string + co; + + while(((*charp != ' ')) && (charp > string)) { + charp--; + co--; + } + + *char_offset = co; + if(string && co) { + *actual_x = TextLength(glob->rp, string, co); + } else { + *actual_x = 0; + } + + ami_font_bm_close(bmfont); + + return true; +} + +ULONG ami_font_bm_text(struct RastPort *rp, const char *string, ULONG length, + const plot_font_style_t *fstyle, ULONG dx, ULONG dy) +{ + struct TextFont *bmfont = ami_font_bm_open(rp, fstyle); + char *localtext = NULL; + if(bmfont == NULL) return 0; + if(utf8_to_local_encoding(string, length, &localtext) == NSERROR_OK) { + Move(rp, dx, dy); + Text(rp, localtext, length); + free(localtext); + } + + return 0; +} + diff --git a/amiga/gui.c b/amiga/gui.c index 753f6901f..184c5b01a 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -204,10 +204,8 @@ void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys); void ami_quit_netsurf_delayed(void); Object *ami_gui_splash_open(void); void ami_gui_splash_close(Object *win_obj); -static uint32 ami_set_favicon_render_hook(struct Hook *hook, APTR space, - struct gpRender *msg); -static uint32 ami_set_throbber_render_hook(struct Hook *hook, APTR space, - struct gpRender *msg); +HOOKF(uint32, ami_set_favicon_render_hook, APTR, space, struct gpRender *); +HOOKF(uint32, ami_set_throbber_render_hook, APTR, space, struct gpRender *); bool ami_gui_map_filename(char **remapped, const char *path, const char *file, const char *map); static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw); @@ -687,7 +685,7 @@ static nsurl *gui_get_resource_url(const char *path) return url; } -static void ami_gui_newprefs_hook(struct Hook *hook, APTR window, APTR reserved) +HOOKF(void, ami_gui_newprefs_hook, APTR, window, APTR) { ami_set_screen_defaults(scrn); } @@ -3644,11 +3642,7 @@ static void ami_refresh_window(struct gui_window_2 *gwin) ami_reset_pointer(gwin); } -#ifdef __amigaos4__ -static void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg) -#else -static ASM void ami_scroller_hook(REG(a0, struct Hook *hook),REG(a2, Object *object), REG(a1, struct IntuiMessage *msg)) -#endif +HOOKF(void, ami_scroller_hook, Object *, object, struct IntuiMessage *) { ULONG gid; struct gui_window_2 *gwin = hook->h_Data; @@ -4996,9 +4990,7 @@ static nserror gui_window_set_url(struct gui_window *g, nsurl *url) return NSERROR_OK; } - -static uint32 ami_set_favicon_render_hook(struct Hook *hook, APTR space, - struct gpRender *msg) +HOOKF(uint32, ami_set_favicon_render_hook, APTR, space, struct gpRender *) { ami_schedule(0, ami_gui_refresh_favicon, hook->h_Data); return 0; @@ -5066,8 +5058,7 @@ static nserror gui_search_web_provider_update(const char *provider_name, return NSERROR_OK; } -static uint32 ami_set_throbber_render_hook(struct Hook *hook, APTR space, - struct gpRender *msg) +HOOKF(uint32, ami_set_throbber_render_hook, APTR, space, struct gpRender *) { struct gui_window_2 *gwin = hook->h_Data; ami_throbber_redraw_schedule(0, gwin->gw); diff --git a/amiga/gui.h b/amiga/gui.h index 246d75124..4d8344be6 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -28,6 +28,12 @@ #include "amiga/plotters.h" #include "amiga/menu.h" +#ifdef __amigaos4__ +#define HOOKF(ret,func,type,ptr,msgtype) static ret func(struct Hook *hook, type ptr, msgtype msg) +#else +#define HOOKF(ret,func,type,ptr) static ASM ret func(REG(a0, struct Hook *hook),REG(a2, type ptr), REG(a1, msgtype msg)) +#endif + enum { OID_MAIN = 0, diff --git a/amiga/menu.c b/amiga/menu.c index aa8203740..e898c1554 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -786,7 +786,7 @@ void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c) * The below functions are called automatically by window.class when menu items are selected. */ -static void ami_menu_item_project_newwin(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_project_newwin, APTR, window, struct IntuiMessage *) { nsurl *url; nserror error; @@ -805,7 +805,7 @@ static void ami_menu_item_project_newwin(struct Hook *hook, APTR window, struct } } -static void ami_menu_item_project_newtab(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_project_newtab, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; nserror error; @@ -814,7 +814,7 @@ static void ami_menu_item_project_newtab(struct Hook *hook, APTR window, struct error = ami_gui_new_blank_tab(gwin); } -static void ami_menu_item_project_open(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_project_open, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -822,7 +822,7 @@ static void ami_menu_item_project_open(struct Hook *hook, APTR window, struct In ami_file_open(gwin); } -static void ami_menu_item_project_save(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_project_save, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; ULONG type = (ULONG)hook->h_Data; @@ -832,7 +832,7 @@ static void ami_menu_item_project_save(struct Hook *hook, APTR window, struct In ami_file_save_req(type, gwin, browser_window_get_content(gwin->gw->bw)); } -static void ami_menu_item_project_closetab(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_project_closetab, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -840,7 +840,7 @@ static void ami_menu_item_project_closetab(struct Hook *hook, APTR window, struc browser_window_destroy(gwin->gw->bw); } -static void ami_menu_item_project_closewin(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_project_closewin, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -848,7 +848,7 @@ static void ami_menu_item_project_closewin(struct Hook *hook, APTR window, struc ami_menu_window_close = gwin; } -static void ami_menu_item_project_print(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_project_print, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -858,7 +858,7 @@ static void ami_menu_item_project_print(struct Hook *hook, APTR window, struct I ami_reset_pointer(gwin); } -static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_project_about, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; char *temp, *temp2; @@ -916,12 +916,12 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct I ami_reset_pointer(gwin); } -static void ami_menu_item_project_quit(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_project_quit, APTR, window, struct IntuiMessage *) { ami_menu_window_close = AMI_MENU_WINDOW_CLOSE_ALL; } -static void ami_menu_item_edit_cut(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_edit_cut, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -929,7 +929,7 @@ static void ami_menu_item_edit_cut(struct Hook *hook, APTR window, struct IntuiM browser_window_key_press(gwin->gw->bw, KEY_CUT_SELECTION); } -static void ami_menu_item_edit_copy(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_edit_copy, APTR, window, struct IntuiMessage *) { struct bitmap *bm; struct gui_window_2 *gwin; @@ -955,7 +955,7 @@ static void ami_menu_item_edit_copy(struct Hook *hook, APTR window, struct Intui #endif } -static void ami_menu_item_edit_paste(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_edit_paste, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -963,7 +963,7 @@ static void ami_menu_item_edit_paste(struct Hook *hook, APTR window, struct Intu browser_window_key_press(gwin->gw->bw, KEY_PASTE); } -static void ami_menu_item_edit_selectall(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_edit_selectall, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -972,7 +972,7 @@ static void ami_menu_item_edit_selectall(struct Hook *hook, APTR window, struct gui_start_selection(gwin->gw); } -static void ami_menu_item_edit_clearsel(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_edit_clearsel, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -980,7 +980,7 @@ static void ami_menu_item_edit_clearsel(struct Hook *hook, APTR window, struct I browser_window_key_press(gwin->gw->bw, KEY_CLEAR_SELECTION); } -static void ami_menu_item_edit_undo(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_edit_undo, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -988,7 +988,7 @@ static void ami_menu_item_edit_undo(struct Hook *hook, APTR window, struct Intui browser_window_key_press(gwin->gw->bw, KEY_UNDO); } -static void ami_menu_item_edit_redo(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_edit_redo, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -996,7 +996,7 @@ static void ami_menu_item_edit_redo(struct Hook *hook, APTR window, struct Intui browser_window_key_press(gwin->gw->bw, KEY_REDO); } -static void ami_menu_item_browser_find(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_find, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -1004,7 +1004,7 @@ static void ami_menu_item_browser_find(struct Hook *hook, APTR window, struct In ami_search_open(gwin->gw); } -static void ami_menu_item_browser_localhistory(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_localhistory, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -1012,17 +1012,17 @@ static void ami_menu_item_browser_localhistory(struct Hook *hook, APTR window, s ami_history_open(gwin->gw); } -static void ami_menu_item_browser_globalhistory(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessage *) { ami_tree_open(global_history_window,AMI_TREE_HISTORY); } -static void ami_menu_item_browser_cookies(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_cookies, APTR, window, struct IntuiMessage *) { ami_tree_open(cookies_window,AMI_TREE_COOKIES); } -static void ami_menu_item_browser_foreimg(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_foreimg, APTR, window, struct IntuiMessage *) { struct Menu *menustrip; bool checked = false; @@ -1034,7 +1034,7 @@ static void ami_menu_item_browser_foreimg(struct Hook *hook, APTR window, struct ami_menu_check_toggled = true; } -static void ami_menu_item_browser_backimg(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_backimg, APTR, window, struct IntuiMessage *) { struct Menu *menustrip; bool checked = false; @@ -1046,7 +1046,7 @@ static void ami_menu_item_browser_backimg(struct Hook *hook, APTR window, struct ami_menu_check_toggled = true; } -static void ami_menu_item_browser_enablejs(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_enablejs, APTR, window, struct IntuiMessage *) { struct Menu *menustrip; bool checked = false; @@ -1058,7 +1058,7 @@ static void ami_menu_item_browser_enablejs(struct Hook *hook, APTR window, struc ami_menu_check_toggled = true; } -static void ami_menu_item_browser_scale_decrease(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_scale_decrease, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -1067,7 +1067,7 @@ static void ami_menu_item_browser_scale_decrease(struct Hook *hook, APTR window, ami_gui_set_scale(gwin->gw, gwin->gw->scale - 0.1); } -static void ami_menu_item_browser_scale_normal(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_scale_normal, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -1075,7 +1075,7 @@ static void ami_menu_item_browser_scale_normal(struct Hook *hook, APTR window, s ami_gui_set_scale(gwin->gw, 1.0); } -static void ami_menu_item_browser_scale_increase(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_scale_increase, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -1083,7 +1083,7 @@ static void ami_menu_item_browser_scale_increase(struct Hook *hook, APTR window, ami_gui_set_scale(gwin->gw, gwin->gw->scale + 0.1); } -static void ami_menu_item_browser_redraw(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_browser_redraw, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -1092,7 +1092,7 @@ static void ami_menu_item_browser_redraw(struct Hook *hook, APTR window, struct gwin->new_content = true; } -static void ami_menu_item_hotlist_add(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_hotlist_add, APTR, window, struct IntuiMessage *) { struct browser_window *bw; struct gui_window_2 *gwin; @@ -1107,12 +1107,12 @@ static void ami_menu_item_hotlist_add(struct Hook *hook, APTR window, struct Int ami_gui_update_hotlist_button(gwin); } -static void ami_menu_item_hotlist_show(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_hotlist_show, APTR, window, struct IntuiMessage *) { ami_tree_open(hotlist_window, AMI_TREE_HOTLIST); } -static void ami_menu_item_hotlist_entries(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_hotlist_entries, APTR, window, struct IntuiMessage *) { nsurl *url = hook->h_Data; struct gui_window_2 *gwin; @@ -1129,12 +1129,12 @@ static void ami_menu_item_hotlist_entries(struct Hook *hook, APTR window, struct NULL); } -static void ami_menu_item_settings_edit(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_settings_edit, APTR, window, struct IntuiMessage *) { ami_gui_opts_open(); } -static void ami_menu_item_settings_snapshot(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_settings_snapshot, APTR, window, struct IntuiMessage *) { struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); @@ -1145,12 +1145,12 @@ static void ami_menu_item_settings_snapshot(struct Hook *hook, APTR window, stru nsoption_set_int(window_height, gwin->win->Height); } -static void ami_menu_item_settings_save(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_settings_save, APTR, window, struct IntuiMessage *) { nsoption_write(current_user_options, NULL, NULL); } -static void ami_menu_item_arexx_execute(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_arexx_execute, APTR, window, struct IntuiMessage *) { char *temp; struct gui_window_2 *gwin; @@ -1174,7 +1174,7 @@ static void ami_menu_item_arexx_execute(struct Hook *hook, APTR window, struct I } } -static void ami_menu_item_arexx_entries(struct Hook *hook, APTR window, struct IntuiMessage *msg) +HOOKF(void, ami_menu_item_arexx_entries, APTR, window, struct IntuiMessage *) { char *script = hook->h_Data; char *temp; diff --git a/amiga/options.h b/amiga/options.h index 868e28fdb..b94242085 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -63,6 +63,7 @@ NSOPTION_STRING(font_unicode, NULL) NSOPTION_STRING(font_unicode_file, NULL) NSOPTION_BOOL(font_unicode_only, false) NSOPTION_BOOL(font_antialiasing, true) +NSOPTION_BOOL(use_diskfont, false) NSOPTION_BOOL(drag_save_icons, true) NSOPTION_INTEGER(hotlist_window_xpos, 0) NSOPTION_INTEGER(hotlist_window_ypos, 0) |