diff options
Diffstat (limited to 'amiga')
-rw-r--r-- | amiga/Makefile.defaults | 6 | ||||
-rw-r--r-- | amiga/Makefile.target | 20 | ||||
-rw-r--r-- | amiga/arexx.c | 6 | ||||
-rw-r--r-- | amiga/bitmap.c | 2 | ||||
-rw-r--r-- | amiga/clipboard.c | 7 | ||||
-rw-r--r-- | amiga/context_menu.c | 7 | ||||
-rwxr-xr-x | amiga/dist/Install | 30 | ||||
-rw-r--r-- | amiga/download.c | 7 | ||||
-rw-r--r-- | amiga/drag.c | 10 | ||||
-rw-r--r-- | amiga/file.c | 9 | ||||
-rwxr-xr-x | amiga/font.c | 26 | ||||
-rw-r--r-- | amiga/font_scan.c | 2 | ||||
-rw-r--r-- | amiga/gui.c | 230 | ||||
-rwxr-xr-x | amiga/gui.h | 1 | ||||
-rwxr-xr-x | amiga/gui_options.c | 80 | ||||
-rwxr-xr-x | amiga/launch.c | 2 | ||||
-rw-r--r-- | amiga/menu.c | 516 | ||||
-rwxr-xr-x | amiga/menu.h | 103 | ||||
-rw-r--r-- | amiga/options.h | 264 | ||||
-rwxr-xr-x | amiga/pkg/makepackage | 10 | ||||
-rwxr-xr-x | amiga/plotters.c | 24 | ||||
-rw-r--r-- | amiga/print.c | 2 | ||||
-rwxr-xr-x | amiga/search.c | 29 | ||||
-rw-r--r-- | amiga/stringview/urlhistory.c | 2 | ||||
-rw-r--r-- | amiga/system_colour.c | 367 | ||||
-rw-r--r-- | amiga/theme.c | 4 | ||||
-rwxr-xr-x | amiga/thumbnail.c | 2 | ||||
-rw-r--r-- | amiga/tree.c | 4 | ||||
-rw-r--r-- | amiga/version.c | 2 |
29 files changed, 669 insertions, 1105 deletions
diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults index 42bcb73ce..5ff1b69c3 100644 --- a/amiga/Makefile.defaults +++ b/amiga/Makefile.defaults @@ -36,5 +36,11 @@ # Valid options: YES, NO, AUTO NETSURF_USE_AMIGA_CAIRO := AUTO + # Enable NetSurf's use of Spidermonkey 1.80+ + # Only here to stop the build complaining; + # enable NETSURF_USE_MOZJS instead for JavaScript support + # Valid options: NO + NETSURF_USE_JS := NO + # Optimisation levels CFLAGS += -O2 -gstabs diff --git a/amiga/Makefile.target b/amiga/Makefile.target index dc79479c5..33ce41e62 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -2,7 +2,7 @@ # Amiga target setup # ---------------------------------------------------------------------------- -CFLAGS += -std=c99 -Dnsamiga +CFLAGS += -std=c99 -Dnsamiga -DFETCHER_CURLL_SCHEDULED ifneq ($(SUBTARGET),os3) CFLAGS += -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__ @@ -72,14 +72,14 @@ EXETARGET := NetSurf # ---------------------------------------------------------------------------- # S_AMIGA are sources purely for the Amiga build -S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \ +S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \ thumbnail.c misc.c bitmap.c font.c filetype.c utf8.c login.c \ plotters.c object.c menu.c save_pdf.c arexx.c version.c \ - cookies.c context_menu.c clipboard.c help.c font_scan.c \ - launch.c search.c history_local.c download.c iff_dr2d.c \ - sslcert.c gui_options.c print.c theme.c drag.c icon.c system_colour.c \ + cookies.c context_menu.c clipboard.c help.c font_scan.c \ + launch.c search.c history_local.c download.c iff_dr2d.c \ + sslcert.c gui_options.c print.c theme.c drag.c icon.c \ datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \ - stringview/stringview.c stringview/urlhistory.c \ + stringview/stringview.c stringview/urlhistory.c \ agclass/amigaguide_class.c S_AMIGA := $(addprefix amiga/,$(S_AMIGA)) @@ -132,10 +132,10 @@ netsurf.lha: $(EXETARGET) $(Q)cp amiga/pkg/drawer.info $(AMIGA_INSTALL_TARGET_DIR)/NetSurf.info $(Q)cp amiga/pkg/AutoInstall $(AMIGA_INSTALL_TARGET_DIR) ifeq ($(HOST),amiga) - $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs - $(Q)cp $(AMIGA_LIBS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs - $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs - $(Q)cp --preserve=timestamps $(AMIGA_SOBJS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs +# $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs +# $(Q)cp $(AMIGA_LIBS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs +# $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs +# $(Q)cp --preserve=timestamps $(AMIGA_SOBJS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs endif $(Q)cd $(AMIGA_INSTALL_TARGET_DIR); \ lha a netsurf.lha NetSurf NetSurf.info AutoInstall diff --git a/amiga/arexx.c b/amiga/arexx.c index 491fc03bd..ed05f6c16 100644 --- a/amiga/arexx.c +++ b/amiga/arexx.c @@ -23,7 +23,7 @@ #include "amiga/gui.h" #include "amiga/hotlist.h" #include "amiga/theme.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/browser_private.h" @@ -455,13 +455,13 @@ STATIC VOID rx_pubscreen(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__ { cmd->ac_RC = 0; - if(nsoption_charp(use_pubscreen) == NULL) + if(nsoption_charp(pubscreen_name) == NULL) { strcpy(result,"NetSurf"); } else { - strcpy(result, nsoption_charp(use_pubscreen)); + strcpy(result, nsoption_charp(pubscreen_name)); } cmd->ac_Result = result; diff --git a/amiga/bitmap.c b/amiga/bitmap.c index c70212a1b..9a71d1cd4 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -28,7 +28,7 @@ #include <graphics/composite.h> #endif #include <graphics/gfxbase.h> -#include "desktop/options.h" +#include "utils/nsoption.h" #include <proto/datatypes.h> #include <datatypes/pictureclass.h> #include <proto/dos.h> diff --git a/amiga/clipboard.c b/amiga/clipboard.c index ae4d8a5d1..fd42f4d61 100644 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -18,9 +18,8 @@ #include "desktop/gui.h" #include "desktop/plotters.h" -#include "desktop/selection.h" #include "desktop/textinput.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "amiga/bitmap.h" #include "amiga/clipboard.h" @@ -239,7 +238,7 @@ void gui_set_clipboard(const char *buffer, size_t length, { if(!(PushChunk(iffh, ID_FTXT, ID_FORM, IFFSIZE_UNKNOWN))) { - if(nsoption_bool(utf8_clipboard)) + if(nsoption_bool(clipboard_write_utf8)) { if(!(PushChunk(iffh, 0, ID_CSET, 32))) { @@ -255,7 +254,7 @@ void gui_set_clipboard(const char *buffer, size_t length, } if(!(PushChunk(iffh, 0, ID_CHRS, IFFSIZE_UNKNOWN))) { - if(nsoption_bool(utf8_clipboard)) { + if(nsoption_bool(clipboard_write_utf8)) { WriteChunkBytes(iffh, buffer, length); } else { if(utf8_to_local_encoding(buffer, length, &text) == UTF8_CONVERT_OK) { diff --git a/amiga/context_menu.c b/amiga/context_menu.c index 0a71d3085..839b60334 100644 --- a/amiga/context_menu.c +++ b/amiga/context_menu.c @@ -34,7 +34,7 @@ #include "amiga/gui.h" #include "amiga/history_local.h" #include "amiga/iff_dr2d.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "amiga/plugin_hack.h" #include "amiga/theme.h" #include "amiga/tree.h" @@ -42,7 +42,6 @@ #include "desktop/browser_private.h" #include "desktop/history_core.h" #include "desktop/hotlist.h" -#include "desktop/selection.h" #include "desktop/searchweb.h" #include "desktop/textinput.h" #include "desktop/tree_url_node.h" @@ -486,7 +485,7 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL, PMIA_Title, (ULONG)ctxmenulab[CMID_SELCUT], PMIA_ID,CMID_SELCUT, - PMIA_Disabled, disabled_noselection && disabled_readonly, + PMIA_Disabled, !(browser_window_get_editor_flags(bw) & BW_EDITOR_CAN_CUT), PMIA_CommKey, "X", TAG_DONE), PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL, @@ -729,6 +728,8 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved { case CMID_SELECTFILE: if(AslRequestTags(filereq, + ASLFR_Window, gwin->win, + ASLFR_SleepWindow, TRUE, ASLFR_TitleText,messages_get("NetSurf"), ASLFR_Screen,scrn, ASLFR_DoSaveMode,FALSE, diff --git a/amiga/dist/Install b/amiga/dist/Install index d550e8b73..3977629d8 100755 --- a/amiga/dist/Install +++ b/amiga/dist/Install @@ -415,20 +415,6 @@ ) ) -(if (= #hotlist-exist 0) - (if (= #old-hotlist-exist 1) - ( - (copyfiles - (prompt "Migrating NetSurf 2.x Hotlist") - (help @copyfiles-help) - (source #old-hotlist) - (dest #user-dir) - (optional "askuser" "force" "oknodelete") - ) - ) - ) -) - (complete 18) (if (>= osver 53) @@ -572,7 +558,21 @@ (help @textfile-help) (dest #user-options) (append "theme:" #theme "\n") - (append "use_pubscreen:Workbench\n") + (append "pubscreen_name:Workbench\n") + ) + + (if (= #hotlist-exist 0) + (if (= #old-hotlist-exist 1) + ( + (copyfiles + (prompt "Migrating NetSurf 2.x Hotlist") + (help @copyfiles-help) + (source #old-hotlist) + (dest #user-dir) + (optional "askuser" "force" "oknodelete") + ) + ) + ) ) ) ) diff --git a/amiga/download.c b/amiga/download.c index b9b27ab9f..6b0e3c8a0 100644 --- a/amiga/download.c +++ b/amiga/download.c @@ -34,7 +34,7 @@ #include "amiga/download.h" #include "amiga/icon.h" #include "amiga/object.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "amiga/bitmap.h" #include "amiga/iff_dr2d.h" #include "amiga/file.h" @@ -43,7 +43,6 @@ #include "amiga/utf8.h" #include "desktop/download.h" -#include "desktop/selection.h" #include "desktop/save_complete.h" #include "image/ico.h" @@ -106,6 +105,8 @@ struct gui_download_window *gui_download_window_create(download_context *ctx, else { if(AslRequestTags(savereq, + ASLFR_Window, gui->shared->win, + ASLFR_SleepWindow, TRUE, ASLFR_TitleText,messages_get("NetSurf"), ASLFR_Screen,scrn, ASLFR_InitialFile, download_context_get_filename(ctx), @@ -352,6 +353,8 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title) linkname = ASPrintf("Link_to_%s",FilePart(url)); if(AslRequestTags(savereq, + ASLFR_Window, g->shared->win, + ASLFR_SleepWindow, TRUE, ASLFR_TitleText,messages_get("NetSurf"), ASLFR_Screen,scrn, ASLFR_InitialFile,linkname, diff --git a/amiga/drag.c b/amiga/drag.c index 45b0843dd..1123ba265 100644 --- a/amiga/drag.c +++ b/amiga/drag.c @@ -37,11 +37,9 @@ #include "amiga/drag.h" #include "amiga/file.h" #include "amiga/filetype.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "amiga/theme.h" -#include "desktop/selection.h" - #include "utils/errors.h" #include "utils/log.h" #include "utils/messages.h" @@ -57,7 +55,7 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c, { const char *filetype = NULL; - if(strcmp(nsoption_charp(use_pubscreen), "Workbench")) return; + if(strcmp(nsoption_charp(pubscreen_name), "Workbench")) return; switch(type) { @@ -89,7 +87,7 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c, drag_save = type; } -void gui_drag_save_selection(struct selection *s, struct gui_window *g) +void gui_drag_save_selection(struct gui_window *g, const char *selection) { ami_drag_icon_show(g->shared->win, "ascii"); @@ -108,7 +106,7 @@ void ami_drag_save(struct Window *win) ami_drag_icon_close(NULL); ami_autoscroll = FALSE; - if(nsoption_charp(use_pubscreen) && (strcmp(nsoption_charp(use_pubscreen),"Workbench") == 0)) + if(nsoption_charp(pubscreen_name) && (strcmp(nsoption_charp(pubscreen_name),"Workbench") == 0)) { which = WhichWorkbenchObject(NULL,scrn->MouseX,scrn->MouseY, WBOBJA_Type,&type, diff --git a/amiga/file.c b/amiga/file.c index 68e2637c2..694285738 100644 --- a/amiga/file.c +++ b/amiga/file.c @@ -29,11 +29,10 @@ #include "content/fetch.h" #include "desktop/browser_private.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/save_complete.h" #include "desktop/save_pdf/pdf_plotters.h" #include "desktop/save_text.h" -#include "desktop/selection.h" #include "utils/messages.h" #include "utils/url.h" @@ -84,6 +83,8 @@ void ami_file_open(struct gui_window_2 *gwin) if(AslRequestTags(filereq, ASLFR_TitleText, messages_get("NetSurf"), + ASLFR_Window, gwin->win, + ASLFR_SleepWindow, TRUE, ASLFR_Screen, scrn, ASLFR_DoSaveMode, FALSE, ASLFR_RejectIcons, TRUE, @@ -214,7 +215,7 @@ void ami_file_save(int type, char *fname, struct Window *win, FWrite(fh, source_data, 1, strlen(source_data)); FClose(fh); } - free(source_data); + free((void *)source_data); } break; } @@ -230,6 +231,8 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin, char *fname = AllocVec(1024, MEMF_CLEAR | MEMF_PRIVATE); if(AslRequestTags(savereq, + ASLFR_Window, gwin->win, + ASLFR_SleepWindow, TRUE, ASLFR_TitleText, messages_get("NetSurf"), ASLFR_Screen, scrn, ASLFR_InitialFile, object ? FilePart(nsurl_access(hlcache_handle_get_url(object))) : "", diff --git a/amiga/font.c b/amiga/font.c index df41301d1..21f26358f 100755 --- a/amiga/font.c +++ b/amiga/font.c @@ -23,7 +23,7 @@ #include "amiga/gui.h" #include "amiga/utf8.h" #include "amiga/object.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "css/css.h" #include "css/utils.h" #include "render/font.h" @@ -327,6 +327,8 @@ bool nsfont_split(const plot_font_style_t *fstyle, utf16next, emwidth); } + tx += tempx; + /* Check whether we have a space */ if (*(string + utf8_pos) == ' ') { /* Got a space */ @@ -341,8 +343,6 @@ bool nsfont_split(const plot_font_style_t *fstyle, } } - tx += tempx; - if ((x < tx) && (*char_offset != 0)) { /* Reached available width, and a space was found; * split there. */ @@ -352,7 +352,7 @@ bool nsfont_split(const plot_font_style_t *fstyle, utf16 = utf16next; utf8_pos = utf8_next(string, length, utf8_pos); - } + }; free(outf16); @@ -584,7 +584,7 @@ int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, if ((*char2 >= 0xD800) && (*char2 <= 0xDBFF)) { /* Don't attempt to kern a UTF-16 surrogate */ - char2 = 0; + *char2 = 0; } if(aa == false) { @@ -622,7 +622,7 @@ int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, kern = 0; - if(char2) EObtainInfo(&ofont->olf_EEngine, + if(*char2) EObtainInfo(&ofont->olf_EEngine, OT_TextKernPair, &kern, TAG_END); @@ -632,7 +632,7 @@ int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, glyphmaptag, glyph, TAG_END); - if(char2) EReleaseInfo(&ofont->olf_EEngine, + if(*char2) EReleaseInfo(&ofont->olf_EEngine, OT_TextKernPair, kern, TAG_END); } @@ -657,7 +657,7 @@ int32 ami_font_width_glyph(struct OutlineFont *ofont, if ((*char2 >= 0xD800) && (*char2 <= 0xDBFF)) { /* Don't attempt to kern a UTF-16 surrogate */ - char2 = 0; + *char2 = 0; } if(ESetInfo(&ofont->olf_EEngine, @@ -674,7 +674,7 @@ int32 ami_font_width_glyph(struct OutlineFont *ofont, kern = 0; - if(char2) { + if(*char2) { if(ESetInfo(&ofont->olf_EEngine, OT_GlyphCode, *char1, OT_GlyphCode2, *char2, @@ -687,7 +687,7 @@ int32 ami_font_width_glyph(struct OutlineFont *ofont, } char_advance = (ULONG)(((char1w - kern) * emwidth) / 65536); - if(char2) EReleaseInfo(&ofont->olf_EEngine, + if(*char2) EReleaseInfo(&ofont->olf_EEngine, OT_TextKernPair, kern, TAG_END); @@ -882,10 +882,10 @@ void ami_font_setdevicedpi(int id) { DisplayInfoHandle dih; struct DisplayInfo dinfo; - ULONG ydpi = nsoption_int(amiga_ydpi); - ULONG xdpi = nsoption_int(amiga_ydpi); + ULONG ydpi = nsoption_int(screen_ydpi); + ULONG xdpi = nsoption_int(screen_ydpi); - nscss_screen_dpi = INTTOFIX(nsoption_int(amiga_ydpi)); + nscss_screen_dpi = INTTOFIX(nsoption_int(screen_ydpi)); if(id && (nsoption_int(monitor_aspect_x) != 0) && (nsoption_int(monitor_aspect_y) != 0)) { diff --git a/amiga/font_scan.c b/amiga/font_scan.c index 768fceef9..b1732da3e 100644 --- a/amiga/font_scan.c +++ b/amiga/font_scan.c @@ -45,7 +45,7 @@ #include "amiga/object.h" #include "amiga/utf8.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "utils/log.h" #include "utils/messages.h" diff --git a/amiga/gui.c b/amiga/gui.c index e2616cf21..a5cac9dfc 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -23,11 +23,10 @@ #include "desktop/history_core.h" #include "desktop/mouse.h" #include "desktop/netsurf.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/save_complete.h" #include "desktop/scrollbar.h" #include "desktop/searchweb.h" -#include "desktop/selection.h" #include "desktop/textinput.h" #include "desktop/tree.h" #include "desktop/tree_url_node.h" @@ -103,6 +102,8 @@ #include <intuition/icclass.h> #include <graphics/rpattr.h> #include <workbench/workbench.h> +#include <intuition/gui.h> +#include <intuition/screens.h> /* ReAction libraries */ #include <proto/bevel.h> @@ -132,6 +133,8 @@ #include <math.h> #include <string.h> +#define AMINS_SCROLLERPEN NUMDRIPENS + #define NSA_KBD_SCROLL_PX 10 /* Extra mouse button defines to match those in intuition/intuition.h */ @@ -193,6 +196,12 @@ static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw); static void ami_do_redraw(struct gui_window_2 *g); static void ami_schedule_redraw_remove(struct gui_window_2 *gwin); +/* accessors for default options - user option is updated if it is set as per default */ +#define nsoption_default_set_int(OPTION, VALUE) \ + if (nsoptions_default[NSOPTION_##OPTION].value.i == nsoptions[NSOPTION_##OPTION].value.i) \ + nsoptions[NSOPTION_##OPTION].value.i = VALUE; \ + nsoptions_default[NSOPTION_##OPTION].value.i = VALUE + STRPTR ami_locale_langs(void) { struct Locale *locale; @@ -282,6 +291,8 @@ bool ami_gui_check_resource(char *fullpath, const char *file) ami_gui_map_filename(&remapped, fullpath, file, "Resource.map"); path_add_part(fullpath, 1024, remapped); + LOG(("Checking for %s", fullpath)); + if(lock = Lock(fullpath, ACCESS_READ)) { UnLock(lock); @@ -308,9 +319,6 @@ bool ami_locate_resource(char *fullpath, const char *file) found = ami_gui_check_resource(fullpath, file); if(found) return true; - /* Secondly check the user's selected theme. NB: ami_locate_resource() - * gets called for Messages before options are loaded */ - if(nsoption_charp(theme)) { strcpy(fullpath, nsoption_charp(theme)); @@ -392,7 +400,108 @@ void ami_open_resources(void) //ami_help_init(NULL); } -void ami_set_options(void) +static UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo) +{ + LONG scrollerfillpen = FALSE; + + GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE); + + if(scrollerfillpen) return FILLPEN; + else return FOREGROUNDPEN; +} + +/** + * set option from pen + */ +static nserror +colour_option_from_pen(UWORD pen, + enum nsoption_e option, + struct Screen *screen, + colour def_colour) +{ + ULONG colour[3]; + struct DrawInfo *drinfo; + + if((option < NSOPTION_SYS_COLOUR_START) || + (option > NSOPTION_SYS_COLOUR_END) || + (nsoptions[option].type != OPTION_COLOUR)) { + return NSERROR_BAD_PARAMETER; + } + + if(screen != NULL) { + drinfo = GetScreenDrawInfo(screen); + if(drinfo != NULL) { + + if(pen == AMINS_SCROLLERPEN) pen = ami_system_colour_scrollbar_fgpen(drinfo); + + /* Get the colour of the pen being used for "pen" */ + GetRGB32(screen->ViewPort.ColorMap, drinfo->dri_Pens[pen], 1, (ULONG *)&colour); + + /* convert it to a color */ + def_colour = ((colour[0] & 0xff000000) >> 24) | + ((colour[1] & 0xff000000) >> 16) | + ((colour[2] & 0xff000000) >> 8); + + FreeScreenDrawInfo(screen, drinfo); + } + } + + if (nsoptions_default[option].value.c == nsoptions[option].value.c) + nsoptions[option].value.c = def_colour; + nsoptions_default[option].value.c = def_colour; + + return NSERROR_OK; +} + +static void ami_set_screen_defaults(struct Screen *screen) +{ + nsoption_default_set_int(window_x, 0); + nsoption_default_set_int(window_y, screen->BarHeight + 1); + nsoption_default_set_int(window_width, screen->Width); + nsoption_default_set_int(window_height, screen->Height - screen->BarHeight - 1); + + nsoption_default_set_int(redraw_tile_size_x, screen->Width); + nsoption_default_set_int(redraw_tile_size_y, screen->Height); + + /* set system colours for amiga ui */ + colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveBorder, screen, 0x00000000); + colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveCaption, screen, 0x00dddddd); + colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_AppWorkspace, screen, 0x00eeeeee); + colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_Background, screen, 0x00aa0000); + colour_option_from_pen(FOREGROUNDPEN, NSOPTION_sys_colour_ButtonFace, screen, 0x00aaaaaa); + colour_option_from_pen(FORESHINEPEN, NSOPTION_sys_colour_ButtonHighlight, screen, 0x00cccccc); + colour_option_from_pen(FORESHADOWPEN, NSOPTION_sys_colour_ButtonShadow, screen, 0x00bbbbbb); + colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_ButtonText, screen, 0x00000000); + colour_option_from_pen(FILLTEXTPEN, NSOPTION_sys_colour_CaptionText, screen, 0x00000000); + colour_option_from_pen(DISABLEDTEXTPEN, NSOPTION_sys_colour_GrayText, screen, 0x00777777); + colour_option_from_pen(SELECTPEN, NSOPTION_sys_colour_Highlight, screen, 0x00ee0000); + colour_option_from_pen(SELECTTEXTPEN, NSOPTION_sys_colour_HighlightText, screen, 0x00000000); + colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_InactiveBorder, screen, 0x00000000); + colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_InactiveCaption, screen, 0x00ffffff); + colour_option_from_pen(INACTIVEFILLTEXTPEN, NSOPTION_sys_colour_InactiveCaptionText, screen, 0x00cccccc); + colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_InfoBackground, screen, 0x00aaaaaa);/* This is wrong, HelpHint backgrounds are pale yellow but doesn't seem to be a DrawInfo pen defined for it. */ + colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_InfoText, screen, 0x00000000); + colour_option_from_pen(MENUBACKGROUNDPEN, NSOPTION_sys_colour_Menu, screen, 0x00aaaaaa); + colour_option_from_pen(MENUTEXTPEN, NSOPTION_sys_colour_MenuText, screen, 0x00000000); + colour_option_from_pen(AMINS_SCROLLERPEN, NSOPTION_sys_colour_Scrollbar, screen, 0x00aaaaaa); + colour_option_from_pen(FORESHADOWPEN, NSOPTION_sys_colour_ThreeDDarkShadow, screen, 0x00555555); + colour_option_from_pen(FOREGROUNDPEN, NSOPTION_sys_colour_ThreeDFace, screen, 0x00dddddd); + colour_option_from_pen(FORESHINEPEN, NSOPTION_sys_colour_ThreeDHighlight, screen, 0x00aaaaaa); + colour_option_from_pen(HALFSHINEPEN, NSOPTION_sys_colour_ThreeDLightShadow, screen, 0x00999999); + colour_option_from_pen(HALFSHADOWPEN, NSOPTION_sys_colour_ThreeDShadow, screen, 0x00777777); + colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_Window, screen, 0x00aaaaaa); + colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_WindowFrame, screen, 0x00000000); + colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_WindowText, screen, 0x00000000); +} + + +/** + * Set option defaults for amiga frontend + * + * @param defaults The option table to update. + * @return error status. + */ +static nserror ami_set_options(struct nsoption_s *defaults) { STRPTR tempacceptlangs; BPTR lock = 0; @@ -441,9 +550,6 @@ void ami_set_options(void) (char *)strdup("PROGDIR:Resources/ca-bundle")); - nsoption_setnull_charp(search_engines_file, - (char *)strdup("PROGDIR:Resources/SearchEngines")); - search_engines_file_location = nsoption_charp(search_engines_file); sprintf(temp, "%s/FontGlyphCache", current_user_dir); @@ -475,24 +581,16 @@ void ami_set_options(void) } } - nsoption_setnull_charp(theme, - (char *)strdup("PROGDIR:Resources/Themes/Default")); - tree_set_icon_dir(strdup("ENV:Sys")); - nsoption_setnull_charp(arexx_dir, (char *)strdup("Rexx")); - nsoption_setnull_charp(arexx_startup, (char *)strdup("Startup.nsrx")); - nsoption_setnull_charp(arexx_shutdown, (char *)strdup("Shutdown.nsrx")); - - if(!nsoption_int(window_width)) nsoption_set_int(window_width, 800); - if(!nsoption_int(window_height)) nsoption_set_int(window_height, 600); - #ifndef __amigaos4__ nsoption_set_bool(download_notify, false); nsoption_set_bool(context_menu, false); nsoption_set_bool(font_antialiasing, false); nsoption_set_bool(truecolour_mouse_pointers, false); #endif + + return NSERROR_OK; } void ami_amiupdate(void) @@ -554,13 +652,6 @@ nsurl *gui_get_resource_url(const char *path) return url; } -/* Documented in desktop/options.h */ -void gui_options_init_defaults(void) -{ - /* Set defaults for absent option strings */ - ami_set_options(); /* check options and set defaults where required */ -} - void gui_init(int argc, char** argv) { BPTR lock = 0; @@ -592,8 +683,7 @@ void gui_init(int argc, char** argv) static void ami_gui_newprefs_hook(struct Hook *hook, APTR window, APTR reserved) { - gui_system_colour_finalize(); - gui_system_colour_init(); + ami_set_screen_defaults(scrn); } void ami_openscreen(void) @@ -605,12 +695,12 @@ void ami_openscreen(void) compositing = ~0UL; else compositing = nsoption_int(screen_compositing); - if (nsoption_charp(use_pubscreen) == NULL) + if (nsoption_charp(pubscreen_name) == NULL) { - if((nsoption_charp(modeid)) && - (strncmp(nsoption_charp(modeid), "0x", 2) == 0)) + if((nsoption_charp(screen_modeid)) && + (strncmp(nsoption_charp(screen_modeid), "0x", 2) == 0)) { - id = strtoul(nsoption_charp(modeid), NULL, 0); + id = strtoul(nsoption_charp(screen_modeid), NULL, 0); } else { @@ -626,8 +716,8 @@ void ami_openscreen(void) char *modeid = malloc(20); id = screenmodereq->sm_DisplayID; sprintf(modeid, "0x%lx", id); - nsoption_set_charp(modeid, modeid); - nsoption_write(current_user_options); + nsoption_set_charp(screen_modeid, modeid); + nsoption_write(current_user_options, NULL, NULL); } FreeAslRequest(screenmodereq); } @@ -654,15 +744,15 @@ void ami_openscreen(void) } else { - nsoption_set_charp(use_pubscreen, + nsoption_set_charp(pubscreen_name, strdup("Workbench")); } } } - if (nsoption_charp(use_pubscreen) != NULL) + if (nsoption_charp(pubscreen_name) != NULL) { - scrn = LockPubScreen(nsoption_charp(use_pubscreen)); + scrn = LockPubScreen(nsoption_charp(pubscreen_name)); if(scrn == NULL) { @@ -673,8 +763,7 @@ void ami_openscreen(void) dri = GetScreenDrawInfo(scrn); ami_font_setdevicedpi(id); - gui_system_colour_finalize(); - gui_system_colour_init(); + ami_set_screen_defaults(scrn); //ami_help_new_screen(scrn); } @@ -688,6 +777,7 @@ void ami_openscreenfirst(void) static void gui_init2(int argc, char** argv) { + struct Screen *screen; nsurl *url; nserror error; struct browser_window *bw = NULL; @@ -707,6 +797,16 @@ static void gui_init2(int argc, char** argv) /* Treeview init code ends up calling a font function which needs this */ glob = &browserglob; + + /* ...and this ensures the treeview at least gets the WB colour palette to work with */ + if(scrn == NULL) { + if(screen = LockPubScreen("Workbench")) { + ami_set_screen_defaults(screen); + UnlockPubScreen(NULL, screen); + } + } else { + ami_set_screen_defaults(scrn); + } /**/ ami_hotlist_initialise(nsoption_charp(hotlist_file)); @@ -817,7 +917,7 @@ static void gui_init2(int argc, char** argv) } } - nsoption_setnull_charp(homepage_url, (char *)strdup(NETSURF_HOMEPAGE)); + nsoption_setnull_charp(homepage_url, (char *)strdup(NETSURF_HOMEPAGE)); if(!notalreadyrunning) { @@ -833,7 +933,6 @@ static void gui_init2(int argc, char** argv) sendcmd = ASPrintf("OPEN \"%s\" NEW",nsoption_charp(homepage_url)); } IDoMethod(arexx_obj,AM_EXECUTE,sendcmd,"NETSURF",NULL,NULL,NULL,NULL); - IDoMethod(arexx_obj,AM_EXECUTE,"TOFRONT","NETSURF",NULL,NULL,NULL,NULL); FreeVec(sendcmd); netsurf_quit=true; @@ -906,7 +1005,7 @@ int main(int argc, char** argv) char temp[1024]; BPTR lock = 0; int32 user = 0; - + nserror ret; Object *splash_window = ami_gui_splash_open(); user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY); @@ -918,9 +1017,6 @@ int main(int argc, char** argv) current_user_options = ASPrintf("%s/Choices", current_user_dir); - if(ami_locate_resource(messages, "Messages") == false) - die("Cannot open Messages file"); - ami_mime_init("PROGDIR:Resources/mimetypes"); sprintf(temp, "%s/mimetypes.user", current_user_dir); ami_mime_init(temp); @@ -930,7 +1026,26 @@ int main(int argc, char** argv) amiga_plugin_hack_init(); amiga_datatypes_init(); - netsurf_init(&argc, &argv, current_user_options, messages); + /* initialise logging. Not fatal if it fails but not much we + * can do about it either. + */ + nslog_init(NULL, &argc, argv); + + /* user options setup */ + ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default); + if (ret != NSERROR_OK) { + die("Options failed to initialise"); + } + nsoption_read(current_user_options, NULL); + nsoption_commandline(&argc, argv, NULL); + + if(ami_locate_resource(messages, "Messages") == false) + die("Cannot open Messages file"); + + ret = netsurf_init(messages); + if (ret != NSERROR_OK) { + die("NetSurf failed to initialise"); + } amiga_icon_init(); @@ -3119,7 +3234,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, CLICKTAB_Labels, &g->shared->tab_list, TAG_DONE); - if(nsoption_bool(new_tab_active)) + if(nsoption_bool(new_tab_is_active)) { RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],g->shared->win,NULL, CLICKTAB_Current,g->tab, @@ -3132,7 +3247,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, g->shared->tabs++; g->shared->next_tab++; - if(nsoption_bool(new_tab_active)) ami_switch_tab(g->shared,false); + if(nsoption_bool(new_tab_is_active)) ami_switch_tab(g->shared,false); ami_update_buttons(g->shared); @@ -3175,9 +3290,9 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, ULONG addtabclosegadget = TAG_IGNORE; ULONG iconifygadget = FALSE; - if (nsoption_charp(use_pubscreen) && + if (nsoption_charp(pubscreen_name) && (locked_screen == TRUE) && - (strcmp(nsoption_charp(use_pubscreen), "Workbench") == 0)) + (strcmp(nsoption_charp(pubscreen_name), "Workbench") == 0)) iconifygadget = TRUE; ami_create_menu(g->shared); @@ -3630,6 +3745,8 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, if(locked_screen) UnlockPubScreen(NULL,scrn); search_web_retrieve_ico(false); + ScreenToFront(scrn); + return g; } @@ -3669,7 +3786,7 @@ ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULO available_width = gwin->win->Width - scrn->WBorLeft - sz; - gad1percent = nsoption_int(toolbar_status_width) / 10000.0; + gad1percent = nsoption_int(toolbar_status_size) / 10000.0; *size1 = (ULONG)(available_width * gad1percent); *size2 = (ULONG)(available_width * (1 - gad1percent)); @@ -4425,12 +4542,17 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, void gui_window_update_extent(struct gui_window *g) { - struct IBox *bbox; + struct IBox *bbox, zbox; ULONG cur_tab = 0; if(!g) return; if(!g->shared->bw->current_content) return; - + /* + zbox.Top = ~0; + zbox.Left = ~0; + zbox.Width = (WORD)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale); + zbox.Height = (WORD)(content_get_height(g->shared->bw->current_content) * g->shared->bw->scale); + */ if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current, g->shared->objects[GID_TABS], (ULONG *)&cur_tab); @@ -4460,7 +4582,7 @@ void gui_window_update_extent(struct gui_window *g) SCROLLER_Visible, bbox->Width, TAG_DONE); } - + //SetWindowAttr(g->shared->win, WA_Zoom, &zbox, sizeof(ULONG)); } g->shared->new_content = true; } diff --git a/amiga/gui.h b/amiga/gui.h index 342c9f7f5..36b7d4d84 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -99,6 +99,7 @@ struct gui_window_2 { bool new_content; bool redraw_scheduled; char *menulab[AMI_MENU_AREXX_MAX + 1]; + Object *menuobj[AMI_MENU_AREXX_MAX + 1]; char menukey[AMI_MENU_AREXX_MAX + 1]; struct Hook menu_hook[AMI_MENU_AREXX_MAX + 1]; UBYTE *menutype; diff --git a/amiga/gui_options.c b/amiga/gui_options.c index 96ac2e416..a1bd2914b 100755 --- a/amiga/gui_options.c +++ b/amiga/gui_options.c @@ -38,7 +38,7 @@ #include "amiga/utf8.h" #include "utils/messages.h" #include "desktop/browser_private.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/searchweb.h" #include <proto/window.h> @@ -96,6 +96,7 @@ enum GID_OPTS_PROXY_PORT, GID_OPTS_PROXY_USER, GID_OPTS_PROXY_PASS, + GID_OPTS_PROXY_BYPASS, GID_OPTS_FETCHMAX, GID_OPTS_FETCHHOST, GID_OPTS_FETCHCACHE, @@ -278,6 +279,7 @@ void ami_gui_opts_setup(void) gadlab[GID_OPTS_PROXY_HOST] = (char *)ami_utf8_easy((char *)messages_get("Host")); gadlab[GID_OPTS_PROXY_USER] = (char *)ami_utf8_easy((char *)messages_get("Username")); gadlab[GID_OPTS_PROXY_PASS] = (char *)ami_utf8_easy((char *)messages_get("Password")); + gadlab[GID_OPTS_PROXY_BYPASS] = (char *)ami_utf8_easy((char *)messages_get("ProxyBypass")); gadlab[GID_OPTS_FETCHMAX] = (char *)ami_utf8_easy((char *)messages_get("FetchesMax")); gadlab[GID_OPTS_FETCHHOST] = (char *)ami_utf8_easy((char *)messages_get("FetchesHost")); gadlab[GID_OPTS_FETCHCACHE] = (char *)ami_utf8_easy((char *)messages_get("FetchesCached")); @@ -401,7 +403,7 @@ void ami_gui_opts_open(void) ULONG screenmodeid = 0; ULONG proxytype = 0; BOOL screenmodedisabled = FALSE, screennamedisabled = FALSE; - BOOL proxyhostdisabled = TRUE, proxyauthdisabled = TRUE; + BOOL proxyhostdisabled = TRUE, proxyauthdisabled = TRUE, proxybypassdisabled = FALSE; BOOL disableanims, animspeeddisabled = FALSE, acceptlangdisabled = FALSE; BOOL scaleselected = nsoption_bool(scale_quality), scaledisabled = FALSE; BOOL download_notify_disabled = FALSE; @@ -415,9 +417,9 @@ void ami_gui_opts_open(void) return; } - if(nsoption_charp(use_pubscreen)) + if(nsoption_charp(pubscreen_name)) { - if(strcmp(nsoption_charp(use_pubscreen),"Workbench") == 0) + if(strcmp(nsoption_charp(pubscreen_name),"Workbench") == 0) { screenoptsselected = 1; screennamedisabled = TRUE; @@ -435,12 +437,13 @@ void ami_gui_opts_open(void) screennamedisabled = TRUE; } - if((nsoption_charp(modeid)) && (strncmp(nsoption_charp(modeid),"0x",2) == 0)) + if((nsoption_charp(screen_modeid)) && + (strncmp(nsoption_charp(screen_modeid),"0x",2) == 0)) { - screenmodeid = strtoul(nsoption_charp(modeid),NULL,0); + screenmodeid = strtoul(nsoption_charp(screen_modeid),NULL,0); } - if(nsoption_bool(http_proxy)) + if(nsoption_bool(http_proxy) == true) { proxytype = nsoption_int(http_proxy_auth) + 1; switch(nsoption_int(http_proxy_auth)) @@ -452,6 +455,8 @@ void ami_gui_opts_open(void) proxyhostdisabled = FALSE; break; } + } else { + proxybypassdisabled = TRUE; } sprintf(animspeed,"%.2f",(float)(nsoption_int(minimum_gif_delay)/100.0)); @@ -579,7 +584,7 @@ void ami_gui_opts_open(void) GA_ID, GID_OPTS_HIDEADS, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_HIDEADS], - GA_Selected, nsoption_bool(block_ads), + GA_Selected, nsoption_bool(block_advertisements), CheckBoxEnd, LayoutEnd, // content blocking LAYOUT_AddChild,VGroupObject, @@ -693,7 +698,7 @@ void ami_gui_opts_open(void) GA_ID, GID_OPTS_SCREENNAME, GA_RelVerify, TRUE, GA_Disabled,screennamedisabled, - STRINGA_TextVal, nsoption_bool(use_pubscreen), + STRINGA_TextVal, nsoption_charp(pubscreen_name), STRINGA_BufferPos,0, StringEnd, LayoutEnd, @@ -743,7 +748,7 @@ void ami_gui_opts_open(void) GA_ID, GID_OPTS_PTROS, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_PTROS], - GA_Selected, nsoption_bool(use_os_pointers), + GA_Selected, nsoption_bool(os_mouse_pointers), CheckBoxEnd, LayoutEnd, // mouse CHILD_WeightedHeight,0, @@ -818,6 +823,16 @@ void ami_gui_opts_open(void) CHILD_Label, LabelObject, LABEL_Text, gadlab[GID_OPTS_PROXY_PASS], LabelEnd, + LAYOUT_AddChild, gow->objects[GID_OPTS_PROXY_BYPASS] = StringObject, + GA_ID, GID_OPTS_PROXY_BYPASS, + GA_RelVerify, TRUE, + GA_Disabled, proxybypassdisabled, + STRINGA_TextVal, nsoption_charp(http_proxy_noproxy), + STRINGA_BufferPos, 0, + StringEnd, + CHILD_Label, LabelObject, + LABEL_Text, gadlab[GID_OPTS_PROXY_BYPASS], + LabelEnd, LayoutEnd, // proxy CHILD_WeightedHeight, 0, LAYOUT_AddChild,VGroupObject, @@ -942,7 +957,7 @@ void ami_gui_opts_open(void) LAYOUT_AddChild, gow->objects[GID_OPTS_DPI_Y] = IntegerObject, GA_ID, GID_OPTS_DPI_Y, GA_RelVerify, TRUE, - INTEGER_Number, nsoption_int(amiga_ydpi), + INTEGER_Number, nsoption_int(screen_ydpi), INTEGER_Minimum, 60, INTEGER_Maximum, 150, INTEGER_Arrows, TRUE, @@ -1163,7 +1178,7 @@ void ami_gui_opts_open(void) GA_ID, GID_OPTS_TAB_ACTIVE, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_TAB_ACTIVE], - GA_Selected, !nsoption_bool(new_tab_active), + GA_Selected, !nsoption_bool(new_tab_is_active), CheckBoxEnd, LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_LAST] = CheckBoxObject, GA_ID, GID_OPTS_TAB_LAST, @@ -1274,7 +1289,7 @@ void ami_gui_opts_open(void) GA_ID, GID_OPTS_CLIPBOARD, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_CLIPBOARD], - GA_Selected, nsoption_bool(utf8_clipboard), + GA_Selected, nsoption_bool(clipboard_write_utf8), CheckBoxEnd, LayoutEnd, // clipboard CHILD_WeightedHeight, 0, @@ -1531,9 +1546,9 @@ void ami_gui_opts_use(bool save) GetAttr(GA_Selected,gow->objects[GID_OPTS_HIDEADS],(ULONG *)&data); if (data) { - nsoption_set_bool(block_ads, true); + nsoption_set_bool(block_advertisements, true); } else { - nsoption_set_bool(block_ads, false); + nsoption_set_bool(block_advertisements, false); } GetAttr(INTEGER_Number,gow->objects[GID_OPTS_HISTORY],(ULONG *)&nsoption_int(expire_url)); @@ -1572,16 +1587,16 @@ void ami_gui_opts_use(bool save) switch(data) { case 0: - nsoption_set_charp(use_pubscreen, strdup("\0")); + nsoption_set_charp(pubscreen_name, strdup("\0")); break; case 1: - nsoption_set_charp(use_pubscreen, (char *)strdup("Workbench")); + nsoption_set_charp(pubscreen_name, (char *)strdup("Workbench")); break; case 2: GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_SCREENNAME],(ULONG *)&data); - nsoption_set_charp(use_pubscreen, (char *)strdup((char *)data)); + nsoption_set_charp(pubscreen_name, (char *)strdup((char *)data)); break; } @@ -1590,7 +1605,7 @@ void ami_gui_opts_use(bool save) { char *modeid = malloc(20); sprintf(modeid,"0x%lx", id); - nsoption_set_charp(modeid, modeid); + nsoption_set_charp(screen_modeid, modeid); } GetAttr(GA_Selected,gow->objects[GID_OPTS_WIN_SIMPLE],(ULONG *)&data); @@ -1614,9 +1629,9 @@ void ami_gui_opts_use(bool save) GetAttr(GA_Selected,gow->objects[GID_OPTS_PTROS],(ULONG *)&data); if (data) { - nsoption_set_bool(use_os_pointers, true); + nsoption_set_bool(os_mouse_pointers, true); } else { - nsoption_set_bool(use_os_pointers, false); + nsoption_set_bool(os_mouse_pointers, false); } GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_PROXY],(ULONG *)&data); @@ -1641,6 +1656,9 @@ void ami_gui_opts_use(bool save) GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_PROXY_PASS],(ULONG *)&data); nsoption_set_charp(http_proxy_auth_pass, (char *)strdup((char *)data)); + GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_PROXY_BYPASS],(ULONG *)&data); + nsoption_set_charp(http_proxy_noproxy, (char *)strdup((char *)data)); + GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FETCHMAX],(ULONG *)&nsoption_int(max_fetchers)); GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FETCHHOST],(ULONG *)&nsoption_int(max_fetchers_per_host)); GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FETCHCACHE],(ULONG *)&nsoption_int(max_cached_fetch_handles)); @@ -1667,7 +1685,7 @@ void ami_gui_opts_use(bool save) nsoption_set_bool(animate_images, true); } - GetAttr(INTEGER_Number,gow->objects[GID_OPTS_DPI_Y],(ULONG *)&nsoption_int(amiga_ydpi)); + GetAttr(INTEGER_Number,gow->objects[GID_OPTS_DPI_Y],(ULONG *)&nsoption_int(screen_ydpi)); ami_font_setdevicedpi(id); // id set above GetAttr(GETFONT_TextAttr,gow->objects[GID_OPTS_FONT_SANS],(ULONG *)&data); @@ -1740,9 +1758,9 @@ void ami_gui_opts_use(bool save) GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_ACTIVE],(ULONG *)&data); if (data) { - nsoption_set_bool(new_tab_active, false); + nsoption_set_bool(new_tab_is_active, false); } else { - nsoption_set_bool(new_tab_active, true); + nsoption_set_bool(new_tab_is_active, true); } GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_LAST],(ULONG *)&data); @@ -1784,9 +1802,9 @@ void ami_gui_opts_use(bool save) GetAttr(GA_Selected,gow->objects[GID_OPTS_CLIPBOARD],(ULONG *)&data); if (data) { - nsoption_set_bool(utf8_clipboard, true); + nsoption_set_bool(clipboard_write_utf8, true); } else { - nsoption_set_bool(utf8_clipboard, false); + nsoption_set_bool(clipboard_write_utf8, false); } GetAttr(GA_Selected,gow->objects[GID_OPTS_CONTEXTMENU],(ULONG *)&data); @@ -1817,6 +1835,7 @@ void ami_gui_opts_use(bool save) nsoption_set_bool(hide_docky_icon, true); } +#ifdef WITH_PDF_EXPORT GetAttr(INTEGER_Number,gow->objects[GID_OPTS_MARGIN_TOP],(ULONG *)&nsoption_int(margin_top)); GetAttr(INTEGER_Number,gow->objects[GID_OPTS_MARGIN_LEFT],(ULONG *)&nsoption_int(margin_left)); @@ -1861,6 +1880,7 @@ void ami_gui_opts_use(bool save) } else { nsoption_set_bool(enable_PDF_password, false); } +#endif if(rescan_fonts == true) { ami_font_finiscanner(); @@ -1868,7 +1888,7 @@ void ami_gui_opts_use(bool save) } if(save == true) { - nsoption_write(current_user_options); + nsoption_write(current_user_options, NULL, NULL); ami_font_savescanner(); /* just in case it has changed and been used only */ } @@ -2010,6 +2030,8 @@ BOOL ami_gui_opts_event(void) gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PASS], gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); + RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_BYPASS], + gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); break; case 1: RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_HOST], @@ -2021,6 +2043,8 @@ BOOL ami_gui_opts_event(void) gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PASS], gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); + RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_BYPASS], + gow->win,NULL, GA_Disabled, FALSE, TAG_DONE); break; case 2: @@ -2034,6 +2058,8 @@ BOOL ami_gui_opts_event(void) gow->win,NULL, GA_Disabled, FALSE, TAG_DONE); RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PASS], gow->win,NULL, GA_Disabled, FALSE, TAG_DONE); + RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_BYPASS], + gow->win,NULL, GA_Disabled, FALSE, TAG_DONE); break; } break; diff --git a/amiga/launch.c b/amiga/launch.c index 20505f3bc..3236e797b 100755 --- a/amiga/launch.c +++ b/amiga/launch.c @@ -30,7 +30,7 @@ #include <proto/utility.h> #include <proto/openurl.h> -#include "desktop/options.h" +#include "utils/nsoption.h" #include "utils/url.h" struct Library *OpenURLBase = NULL; diff --git a/amiga/menu.c b/amiga/menu.c index c710bffac..3e9ac9708 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-9 Chris Young <chris@unsatisfactorysoftware.co.uk> + * Copyright 2008-9,2013 Chris Young <chris@unsatisfactorysoftware.co.uk> * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -50,7 +50,7 @@ #include "amiga/history_local.h" #include "amiga/hotlist.h" #include "amiga/menu.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "amiga/print.h" #include "amiga/search.h" #include "amiga/theme.h" @@ -60,28 +60,17 @@ #include "desktop/hotlist.h" #include "desktop/browser_private.h" #include "desktop/gui.h" -#include "desktop/selection.h" #include "desktop/textinput.h" #include "utils/messages.h" #include "utils/schedule.h" -#define IMAGE_MENU_ITEM(n, i, t) \ - gwin->menulab[n] = LabelObject, \ - LABEL_DrawInfo, dri, \ - LABEL_Image, BitMapObject, \ - BITMAP_Screen, scrn, \ - BITMAP_SourceFile, i, \ - BitMapEnd, \ - LABEL_Text, t, \ - LabelEnd; - BOOL menualreadyinit; const char * const netsurf_version; const char * const verdate; -ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin); +ULONG ami_menu_scan(struct tree *tree, struct gui_window_2 *gwin); void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen, - ULONG *item, bool count, struct gui_window_2 *gwin); + int *item, struct gui_window_2 *gwin); void ami_menu_arexx_scan(struct gui_window_2 *gwin); /* Functions for menu selections */ @@ -130,13 +119,11 @@ void ami_free_menulabs(struct gui_window_2 *gwin) { if(gwin->menutype[i] & MENU_IMAGE) { - //TODO: Free image structure - } - else - { - ami_utf8_free(gwin->menulab[i]); + DisposeObject(gwin->menuobj[i]); } + ami_utf8_free(gwin->menulab[i]); + if(i >= AMI_MENU_AREXX) { if(gwin->menu_hook[i].h_Data) free(gwin->menu_hook[i].h_Data); @@ -144,6 +131,7 @@ void ami_free_menulabs(struct gui_window_2 *gwin) } gwin->menulab[i] = NULL; + gwin->menuobj[i] = NULL; gwin->menukey[i] = 0; } @@ -154,6 +142,28 @@ void ami_free_menulabs(struct gui_window_2 *gwin) gwin->menu = NULL; } +static void ami_menu_alloc_item(struct gui_window_2 *gwin, int num, UBYTE type, + const char *label, char key, struct bitmap *bm, void *func, void *hookdata) +{ + gwin->menutype[num] = type; + + if((label == NM_BARLABEL) || (strcmp(label, "--") == 0)) { + gwin->menulab[num] = NM_BARLABEL; + } else { + if((num >= AMI_MENU_HOTLIST) && (num <= AMI_MENU_HOTLIST_MAX)) { + gwin->menulab[num] = ami_utf8_easy(label); + } else if((num >= AMI_MENU_AREXX) && (num <= AMI_MENU_AREXX_MAX)) { + gwin->menulab[num] = strdup(label); + } else { + gwin->menulab[num] = ami_utf8_easy(messages_get(label)); + } + } + + if(key) gwin->menukey[num] = key; + if(func) gwin->menu_hook[num].h_Entry = (HOOKFUNC)func; + if(hookdata) gwin->menu_hook[num].h_Data = hookdata; +} + void ami_init_menulabs(struct gui_window_2 *gwin) { int i; @@ -164,236 +174,111 @@ void ami_init_menulabs(struct gui_window_2 *gwin) { gwin->menutype[i] = NM_IGNORE; gwin->menulab[i] = NULL; + gwin->menuobj[i] = NULL; } - gwin->menutype[0] = NM_TITLE; - gwin->menulab[0] = ami_utf8_easy((char *)messages_get("Project")); - - gwin->menutype[1] = NM_ITEM; - gwin->menulab[1] = ami_utf8_easy((char *)messages_get("NewWindowNS")); - gwin->menukey[1] = 'N'; - gwin->menu_hook[1].h_Entry = (HOOKFUNC)ami_menu_item_project_newwin; - - gwin->menutype[2] = NM_ITEM; - gwin->menulab[2] = ami_utf8_easy((char *)messages_get("NewTab")); - gwin->menukey[2] = 'T'; - gwin->menu_hook[2].h_Entry = (HOOKFUNC)ami_menu_item_project_newtab; - - gwin->menutype[3] = NM_ITEM; - gwin->menulab[3] = NM_BARLABEL; - - gwin->menutype[4] = NM_ITEM; - gwin->menulab[4] = ami_utf8_easy((char *)messages_get("OpenFile")); - gwin->menukey[4] = 'O'; - gwin->menu_hook[4].h_Entry = (HOOKFUNC)ami_menu_item_project_open; - - gwin->menutype[5] = NM_ITEM; - gwin->menulab[5] = ami_utf8_easy((char *)messages_get("SaveAsNS")); - - gwin->menutype[6] = NM_SUB; - gwin->menulab[6] = ami_utf8_easy((char *)messages_get("Source")); - gwin->menukey[6] = 'S'; - gwin->menu_hook[6].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[6].h_Data = AMINS_SAVE_SOURCE; - - gwin->menutype[7] = NM_SUB; - gwin->menulab[7] = ami_utf8_easy((char *)messages_get("TextNS")); - gwin->menu_hook[7].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[7].h_Data = (void *)AMINS_SAVE_TEXT; - - gwin->menutype[8] = NM_SUB; - gwin->menulab[8] = ami_utf8_easy((char *)messages_get("SaveCompNS")); - gwin->menu_hook[8].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[8].h_Data = (void *)AMINS_SAVE_COMPLETE; - - gwin->menutype[9] = NM_SUB; - gwin->menulab[9] = ami_utf8_easy((char *)messages_get("PDFNS")); - gwin->menu_hook[9].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[9].h_Data = (void *)AMINS_SAVE_PDF; - - gwin->menutype[10] = NM_SUB; - gwin->menulab[10] = ami_utf8_easy((char *)messages_get("IFF")); - gwin->menu_hook[10].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[10].h_Data = (void *)AMINS_SAVE_IFF; - - gwin->menutype[11] = NM_ITEM; - gwin->menulab[11] = NM_BARLABEL; - - gwin->menutype[12] = NM_ITEM; - gwin->menulab[12] = ami_utf8_easy((char *)messages_get("CloseTab")); - gwin->menukey[12] = 'K'; - gwin->menu_hook[12].h_Entry = (HOOKFUNC)ami_menu_item_project_closetab; - - gwin->menutype[13] = NM_ITEM; - gwin->menulab[13] = ami_utf8_easy((char *)messages_get("CloseWindow")); - gwin->menu_hook[13].h_Entry = (HOOKFUNC)ami_menu_item_project_closewin; - - gwin->menutype[14] = NM_ITEM; - gwin->menulab[14] = NM_BARLABEL; - - gwin->menutype[15] = NM_ITEM; - gwin->menulab[15] = ami_utf8_easy((char *)messages_get("PrintNS")); - gwin->menukey[15] = 'P'; - gwin->menu_hook[15].h_Entry = (HOOKFUNC)ami_menu_item_project_print; - - gwin->menutype[16] = NM_ITEM; - gwin->menulab[16] = NM_BARLABEL; - - gwin->menutype[17] = NM_ITEM; - gwin->menulab[17] = ami_utf8_easy((char *)messages_get("About")); - gwin->menukey[17] = '?'; - gwin->menu_hook[17].h_Entry = (HOOKFUNC)ami_menu_item_project_about; - - gwin->menutype[18] = NM_ITEM; - gwin->menulab[18] = ami_utf8_easy((char *)messages_get("Quit")); - gwin->menukey[18] = 'Q'; - gwin->menu_hook[18].h_Entry = (HOOKFUNC)ami_menu_item_project_quit; - - gwin->menutype[19] = NM_TITLE; - gwin->menulab[19] = ami_utf8_easy((char *)messages_get("Edit")); - - gwin->menutype[20] = NM_ITEM; - gwin->menulab[20] = ami_utf8_easy((char *)messages_get("CutNS")); - gwin->menukey[20] = 'X'; - gwin->menu_hook[20].h_Entry = (HOOKFUNC)ami_menu_item_edit_cut; - - gwin->menutype[21] = NM_ITEM; - gwin->menulab[21] = ami_utf8_easy((char *)messages_get("CopyNS")); - gwin->menukey[21] = 'C'; - gwin->menu_hook[21].h_Entry = (HOOKFUNC)ami_menu_item_edit_copy; - - gwin->menutype[22] = NM_ITEM; - gwin->menulab[22] = ami_utf8_easy((char *)messages_get("PasteNS")); - gwin->menukey[22] = 'V'; - gwin->menu_hook[22].h_Entry = (HOOKFUNC)ami_menu_item_edit_paste; - - gwin->menutype[23] = NM_ITEM; - gwin->menulab[23] = NM_BARLABEL; - - gwin->menutype[24] = NM_ITEM; - gwin->menulab[24] = ami_utf8_easy((char *)messages_get("SelectAllNS")); - gwin->menukey[24] = 'A'; - gwin->menu_hook[24].h_Entry = (HOOKFUNC)ami_menu_item_edit_selectall; - - gwin->menutype[25] = NM_ITEM; - gwin->menulab[25] = ami_utf8_easy((char *)messages_get("ClearNS")); - gwin->menukey[25] = 'Z'; - gwin->menu_hook[25].h_Entry = (HOOKFUNC)ami_menu_item_edit_clearsel; - - gwin->menutype[26] = NM_TITLE; - gwin->menulab[26] = ami_utf8_easy((char *)messages_get("Browser")); - - gwin->menutype[27] = NM_ITEM; - gwin->menulab[27] = ami_utf8_easy((char *)messages_get("FindTextNS")); - gwin->menukey[27] = 'F'; - gwin->menu_hook[27].h_Entry = (HOOKFUNC)ami_menu_item_browser_find; - - gwin->menutype[28] = NM_ITEM; - gwin->menulab[28] = NM_BARLABEL; - - gwin->menutype[29] = NM_ITEM; - gwin->menulab[29] = ami_utf8_easy((char *)messages_get("HistLocalNS")); - gwin->menu_hook[29].h_Entry = (HOOKFUNC)ami_menu_item_browser_localhistory; - - gwin->menutype[30] = NM_ITEM; - gwin->menulab[30] = ami_utf8_easy((char *)messages_get("HistGlobalNS")); - gwin->menu_hook[30].h_Entry = (HOOKFUNC)ami_menu_item_browser_globalhistory; - - gwin->menutype[31] = NM_ITEM; - gwin->menulab[31] = NM_BARLABEL; - - gwin->menutype[32] = NM_ITEM; - gwin->menulab[32] = ami_utf8_easy((char *)messages_get("ShowCookies")); - gwin->menu_hook[32].h_Entry = (HOOKFUNC)ami_menu_item_browser_cookies; - - gwin->menutype[33] = NM_ITEM; - gwin->menulab[33] = NM_BARLABEL; - - gwin->menutype[34] = NM_ITEM; - gwin->menulab[34] = ami_utf8_easy((char *)messages_get("ScaleNS")); - - gwin->menutype[35] = NM_SUB; - gwin->menulab[35] = ami_utf8_easy((char *)messages_get("ScaleDec")); - gwin->menukey[35] = '-'; - gwin->menu_hook[35].h_Entry = (HOOKFUNC)ami_menu_item_browser_scale_decrease; - - gwin->menutype[36] = NM_SUB; - gwin->menulab[36] = ami_utf8_easy((char *)messages_get("ScaleNorm")); - gwin->menukey[36] = '='; - gwin->menu_hook[36].h_Entry = (HOOKFUNC)ami_menu_item_browser_scale_normal; - - gwin->menutype[37] = NM_SUB; - gwin->menulab[37] = ami_utf8_easy((char *)messages_get("ScaleInc")); - gwin->menukey[37] = '+'; - gwin->menu_hook[37].h_Entry = (HOOKFUNC)ami_menu_item_browser_scale_increase; - - gwin->menutype[38] = NM_ITEM; - gwin->menulab[38] = ami_utf8_easy((char *)messages_get("Images")); - - gwin->menutype[39] = NM_SUB; - gwin->menulab[39] = ami_utf8_easy((char *)messages_get("ForeImg")); - gwin->menu_hook[39].h_Entry = (HOOKFUNC)ami_menu_item_browser_foreimg; - - gwin->menutype[40] = NM_SUB; - gwin->menulab[40] = ami_utf8_easy((char *)messages_get("BackImg")); - gwin->menu_hook[40].h_Entry = (HOOKFUNC)ami_menu_item_browser_backimg; - - gwin->menutype[41] = NM_ITEM; - gwin->menulab[41] = ami_utf8_easy((char *)messages_get("EnableJS")); - gwin->menu_hook[41].h_Entry = (HOOKFUNC)ami_menu_item_browser_enablejs; - - gwin->menutype[42] = NM_ITEM; - gwin->menulab[42] = NM_BARLABEL; - - gwin->menutype[43] = NM_ITEM; - gwin->menulab[43] = ami_utf8_easy((char *)messages_get("Redraw")); - gwin->menu_hook[43].h_Entry = (HOOKFUNC)ami_menu_item_browser_redraw; - - gwin->menutype[44] = NM_TITLE; - gwin->menulab[44] = ami_utf8_easy((char *)messages_get("Hotlist")); - - gwin->menutype[45] = NM_ITEM; - gwin->menulab[45] = ami_utf8_easy((char *)messages_get("HotlistAdd")); - gwin->menukey[45] = 'B'; - gwin->menu_hook[45].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_add; - - gwin->menutype[46] = NM_ITEM; - gwin->menulab[46] = ami_utf8_easy((char *)messages_get("HotlistShowNS")); - gwin->menukey[46] = 'H'; - gwin->menu_hook[46].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_show; - - gwin->menutype[47] = NM_ITEM; - gwin->menulab[47] = NM_BARLABEL; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 1] = NM_TITLE; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 1] = ami_utf8_easy((char *)messages_get("Settings")); - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 2] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 2] = ami_utf8_easy((char *)messages_get("SettingsEdit")); - gwin->menu_hook[AMI_MENU_HOTLIST_MAX + 2].h_Entry = (HOOKFUNC)ami_menu_item_settings_edit; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 3] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 3] = NM_BARLABEL; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 4] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 4] = ami_utf8_easy((char *)messages_get("SnapshotWindow")); - gwin->menu_hook[AMI_MENU_HOTLIST_MAX + 4].h_Entry = (HOOKFUNC)ami_menu_item_settings_snapshot; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 5] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 5] = ami_utf8_easy((char *)messages_get("SettingsSave")); - gwin->menu_hook[AMI_MENU_HOTLIST_MAX + 5].h_Entry = (HOOKFUNC)ami_menu_item_settings_save; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 6] = NM_TITLE; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 6] = ami_utf8_easy((char *)messages_get("ARexx")); - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 7] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 7] = ami_utf8_easy((char *)messages_get("ARexxExecute")); - gwin->menukey[AMI_MENU_HOTLIST_MAX + 7] = 'E'; - gwin->menu_hook[AMI_MENU_HOTLIST_MAX + 7].h_Entry = (HOOKFUNC)ami_menu_item_arexx_execute; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 8] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 8] = NM_BARLABEL; - + ami_menu_alloc_item(gwin, M_PROJECT, NM_TITLE, "Project", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_NEWWIN, NM_ITEM, "NewWindowNS", 'N', NULL, + ami_menu_item_project_newwin, NULL); + ami_menu_alloc_item(gwin, M_NEWTAB, NM_ITEM, "NewTab", 'T', NULL, + ami_menu_item_project_newtab, NULL); + ami_menu_alloc_item(gwin, M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_OPEN, NM_ITEM, "OpenFile", 'O', NULL, + ami_menu_item_project_open, NULL); + ami_menu_alloc_item(gwin, M_SAVEAS, NM_ITEM, "SaveAsNS", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SAVESRC, NM_SUB, "Source", 'S', NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_SOURCE); + ami_menu_alloc_item(gwin, M_SAVETXT, NM_SUB, "TextNS", 0, NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_TEXT); + ami_menu_alloc_item(gwin, M_SAVECOMP, NM_SUB, "SaveCompNS", 0, NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_COMPLETE); +#ifdef WITH_PDF_EXPORT + ami_menu_alloc_item(gwin, M_SAVEPDF, NM_SUB, "PDFNS", 0, NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_PDF); +#endif + ami_menu_alloc_item(gwin, M_SAVEIFF, NM_SUB, "IFF", 0, NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_IFF); + ami_menu_alloc_item(gwin, M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_CLOSETAB, NM_ITEM, "CloseTab", 'K', NULL, + ami_menu_item_project_closetab, NULL); + ami_menu_alloc_item(gwin, M_CLOSEWIN, NM_ITEM, "CloseWindow", 0, NULL, + ami_menu_item_project_closewin, NULL); + ami_menu_alloc_item(gwin, M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_PRINT, NM_ITEM, "PrintNS", 'P', NULL, + ami_menu_item_project_print, NULL); + ami_menu_alloc_item(gwin, M_BAR_P4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_ABOUT, NM_ITEM, "About", '?', NULL, + ami_menu_item_project_about, NULL); + ami_menu_alloc_item(gwin, M_QUIT, NM_ITEM, "Quit", 'Q', NULL, + ami_menu_item_project_quit, NULL); + + ami_menu_alloc_item(gwin, M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_CUT, NM_ITEM, "CutNS", 'X', NULL, + ami_menu_item_edit_cut, NULL); + ami_menu_alloc_item(gwin, M_COPY, NM_ITEM, "CopyNS", 'C', NULL, + ami_menu_item_edit_copy, NULL); + ami_menu_alloc_item(gwin, M_PASTE, NM_ITEM, "PasteNS", 'V', NULL, + ami_menu_item_edit_paste, NULL); + ami_menu_alloc_item(gwin, M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SELALL, NM_ITEM, "SelectAllNS", 'A', NULL, + ami_menu_item_edit_selectall, NULL); + ami_menu_alloc_item(gwin, M_CLEAR, NM_ITEM, "ClearNS", 'Z', NULL, + ami_menu_item_edit_clearsel, NULL); + + ami_menu_alloc_item(gwin, M_BROWSER, NM_TITLE, "Browser", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_FIND, NM_ITEM, "FindTextNS", 'F', NULL, + ami_menu_item_browser_find, NULL); + ami_menu_alloc_item(gwin, M_BAR_B1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_HISTLOCL, NM_ITEM, "HistLocalNS", 0, NULL, + ami_menu_item_browser_localhistory, NULL); + ami_menu_alloc_item(gwin, M_HISTGLBL, NM_ITEM, "HistGlobalNS", 0, NULL, + ami_menu_item_browser_globalhistory, NULL); + ami_menu_alloc_item(gwin, M_BAR_B2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_COOKIES, NM_ITEM, "ShowCookies", 0, NULL, + ami_menu_item_browser_cookies, NULL); + ami_menu_alloc_item(gwin, M_BAR_B3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SCALE, NM_ITEM, "ScaleNS", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SCALEDEC, NM_SUB, "ScaleDec", '-', NULL, + ami_menu_item_browser_scale_decrease, NULL); + ami_menu_alloc_item(gwin, M_SCALENRM, NM_SUB, "ScaleNorm", '=', NULL, + ami_menu_item_browser_scale_normal, NULL); + ami_menu_alloc_item(gwin, M_SCALEDEC, NM_SUB, "ScaleDec", '-', NULL, + ami_menu_item_browser_scale_decrease, NULL); + ami_menu_alloc_item(gwin, M_SCALEINC, NM_SUB, "ScaleInc", '+', NULL, + ami_menu_item_browser_scale_increase, NULL); + ami_menu_alloc_item(gwin, M_IMAGES, NM_ITEM, "Images", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_IMGFORE, NM_SUB, "ForeImg", 0, NULL, + ami_menu_item_browser_foreimg, NULL); + ami_menu_alloc_item(gwin, M_IMGBACK, NM_SUB, "BackImg", 0, NULL, + ami_menu_item_browser_backimg, NULL); +#if defined(WITH_JS) || defined(WITH_MOZJS) + ami_menu_alloc_item(gwin, M_JS, NM_ITEM, "EnableJS", 0, NULL, + ami_menu_item_browser_enablejs, NULL); +#endif + ami_menu_alloc_item(gwin, M_BAR_B4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_REDRAW, NM_ITEM, "Redraw", 0, NULL, + ami_menu_item_browser_redraw, NULL); + + ami_menu_alloc_item(gwin, M_HOTLIST, NM_TITLE, "Hotlist", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_HLADD, NM_ITEM, "HotlistAdd", 'B', NULL, + ami_menu_item_hotlist_add, NULL); + ami_menu_alloc_item(gwin, M_HLSHOW, NM_ITEM,"HotlistShowNS",'H', NULL, + ami_menu_item_hotlist_show, NULL); + ami_menu_alloc_item(gwin, M_BAR_H1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + + ami_menu_alloc_item(gwin, M_PREFS, NM_TITLE, "Settings", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_PREDIT, NM_ITEM, "SettingsEdit", 0, NULL, + ami_menu_item_settings_edit, NULL); + ami_menu_alloc_item(gwin, M_BAR_S1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SNAPSHOT, NM_ITEM, "SnapshotWindow",0, NULL, + ami_menu_item_settings_snapshot, NULL); + ami_menu_alloc_item(gwin, M_PRSAVE, NM_ITEM, "SettingsSave", 0, NULL, + ami_menu_item_settings_save, NULL); + + ami_menu_alloc_item(gwin, M_AREXX, NM_TITLE, "ARexx", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_AREXXEX, NM_ITEM, "ARexxExecute",'E', NULL, + ami_menu_item_arexx_execute, NULL); + ami_menu_alloc_item(gwin, M_BAR_A1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); gwin->menutype[AMI_MENU_AREXX_MAX] = NM_END; } @@ -416,47 +301,40 @@ struct NewMenu *ami_create_menu(struct gui_window_2 *gwin) { int i; - ami_init_menulabs(gwin); gwin->menu = AllocVec(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), MEMF_CLEAR); + ami_init_menulabs(gwin); + ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin); + ami_menu_arexx_scan(gwin); for(i=0;i<=AMI_MENU_AREXX_MAX;i++) { gwin->menu[i].nm_Type = gwin->menutype[i]; - gwin->menu[i].nm_Label = gwin->menulab[i]; + if(gwin->menuobj[i]) + gwin->menu[i].nm_Label = (void *)gwin->menuobj[i]; + else + gwin->menu[i].nm_Label = gwin->menulab[i]; + if(gwin->menukey[i]) gwin->menu[i].nm_CommKey = &gwin->menukey[i]; gwin->menu[i].nm_Flags = 0; if(gwin->menu_hook[i].h_Entry) gwin->menu[i].nm_UserData = &gwin->menu_hook[i]; } - gwin->menu[1].nm_Flags = 0; - gwin->menu[2].nm_Flags = 0; - gwin->menu[12].nm_Flags = 0; - gwin->menu[13].nm_Flags = 0; - -#ifndef WITH_PDF_EXPORT - gwin->menu[9].nm_Flags = NM_ITEMDISABLED; -#endif -#if !defined(WITH_JS) && !defined(WITH_MOZJS) - gwin->menu[41].nm_Flags = NM_ITEMDISABLED | CHECKIT | MENUTOGGLE; -#else - gwin->menu[41].nm_Flags = CHECKIT | MENUTOGGLE; +#if defined(WITH_JS) || defined(WITH_MOZJS) + gwin->menu[M_JS].nm_Flags = CHECKIT | MENUTOGGLE; if(nsoption_bool(enable_javascript) == true) - gwin->menu[41].nm_Flags |= CHECKED; + gwin->menu[M_JS].nm_Flags |= CHECKED; #endif - gwin->menu[15].nm_Flags = NM_ITEMDISABLED; + gwin->menu[M_PRINT].nm_Flags = NM_ITEMDISABLED; - gwin->menu[39].nm_Flags = CHECKIT | MENUTOGGLE; + gwin->menu[M_IMGFORE].nm_Flags = CHECKIT | MENUTOGGLE; if(nsoption_bool(foreground_images) == true) - gwin->menu[39].nm_Flags |= CHECKED; - gwin->menu[40].nm_Flags = CHECKIT | MENUTOGGLE; + gwin->menu[M_IMGFORE].nm_Flags |= CHECKED; + gwin->menu[M_IMGBACK].nm_Flags = CHECKIT | MENUTOGGLE; if(nsoption_bool(background_images) == true) - gwin->menu[40].nm_Flags |= CHECKED; - - ami_menu_scan(ami_tree_get_tree(hotlist_window), false, gwin); - ami_menu_arexx_scan(gwin); + gwin->menu[M_IMGBACK].nm_Flags |= CHECKED; -/* Set up scheduler to refresh the hotlist menu */ + /* Set up scheduler to refresh the hotlist menu */ if(nsoption_int(menu_refresh) > 0) schedule(nsoption_int(menu_refresh), (void *)ami_menu_refresh, gwin); @@ -472,6 +350,7 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin) char matchpatt[16]; LONG cont; struct ExAllData *ead; + char *menu_lab; if(lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK)) { @@ -499,18 +378,12 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin) { gwin->menu[item].nm_Type = NM_ITEM; if(ead->ed_Comment[0] != '\0') - { - gwin->menulab[item] = (char *)strdup(ead->ed_Comment); - } + menu_lab = ead->ed_Comment; else - { - gwin->menulab[item] = (char *)strdup(ead->ed_Name); - } + menu_lab = ead->ed_Name; - gwin->menu[item].nm_Label = gwin->menulab[item]; - gwin->menu_hook[item].h_Entry = (HOOKFUNC)ami_menu_item_arexx_entries; - gwin->menu_hook[item].h_Data = (char *)strdup(ead->ed_Name); - gwin->menu[item].nm_UserData = (HOOKFUNC)&gwin->menu_hook[item]; + ami_menu_alloc_item(gwin, item, NM_ITEM, menu_lab, 0, NULL, + ami_menu_item_arexx_entries, (void *)strdup(ead->ed_Name)); item++; } @@ -527,13 +400,13 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin) gwin->menu[item].nm_Label = NULL; } -ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin) +ULONG ami_menu_scan(struct tree *tree, struct gui_window_2 *gwin) { struct node *root = tree_node_get_child(tree_get_root(tree)); struct node *node; struct node_element *element; WORD gen = 0; - ULONG item; + int item; item = AMI_MENU_HOTLIST; @@ -544,7 +417,7 @@ ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin) if(element && (strcmp(tree_node_element_get_text(element), messages_get("HotlistMenu")) == 0)) { // found menu - ami_menu_scan_2(tree, tree_node_get_child(node), &gen, &item, count, gwin); + ami_menu_scan_2(tree, tree_node_get_child(node), &gen, &item, gwin); } } @@ -552,11 +425,12 @@ ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin) } void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen, - ULONG *item, bool count, struct gui_window_2 *gwin) + int *item, struct gui_window_2 *gwin) { struct node *tempnode; struct node_element *element=NULL; struct node *node; + UBYTE menu_type; *gen = *gen + 1; @@ -564,37 +438,22 @@ void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen, { if((*gen > 0) && (*gen < 3)) { -// if(*item >= AMI_MENU_HOTLIST_MAX) return; + if(*item >= AMI_MENU_HOTLIST_MAX) return; - if(!count) - { - if(*gen == 1) gwin->menu[*item].nm_Type = NM_ITEM; - if(*gen == 2) gwin->menu[*item].nm_Type = NM_SUB; - - if(strcmp(tree_url_node_get_title(node),"--")) - { - gwin->menulab[*item] = ami_utf8_easy((char *)tree_url_node_get_title(node)); - } - else - { - gwin->menulab[*item] = NM_BARLABEL; - } + if(*gen == 1) menu_type = NM_ITEM; + if(*gen == 2) menu_type = NM_SUB; - gwin->menu[*item].nm_Label = gwin->menulab[*item]; - gwin->menu_hook[*item].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_entries; - gwin->menu_hook[*item].h_Data = (void *)tree_url_node_get_url(node); - gwin->menu[*item].nm_UserData = (HOOKFUNC)&gwin->menu_hook[*item]; - if(tree_node_is_folder(node) && (!tree_node_get_child(node))) - gwin->menu[*item].nm_Flags = NM_ITEMDISABLED; - } + ami_menu_alloc_item(gwin, *item, menu_type, tree_url_node_get_title(node), + 0, tree_url_node_get_icon(node), + ami_menu_item_hotlist_entries, (void *)tree_url_node_get_url(node)); + if(tree_node_is_folder(node) && (!tree_node_get_child(node))) + gwin->menu[*item].nm_Flags = NM_ITEMDISABLED; *item = *item + 1; } if (tree_node_get_child(node)) - { - ami_menu_scan_2(tree,tree_node_get_child(node),gen,item,count,gwin); - } + ami_menu_scan_2(tree, tree_node_get_child(node), gen, item, gwin); } *gen = *gen - 1; @@ -606,7 +465,7 @@ void ami_menu_update_checked(struct gui_window_2 *gwin) GetAttr(WINDOW_MenuStrip, gwin->objects[OID_MAIN], (ULONG *)&menustrip); if(!menustrip) return; - +#if defined(WITH_JS) || defined(WITH_MOZJS) if(nsoption_bool(enable_javascript) == true) { if((ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED) == 0) ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED; @@ -614,7 +473,7 @@ void ami_menu_update_checked(struct gui_window_2 *gwin) if(ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED) ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED; } - +#endif if(nsoption_bool(foreground_images) == true) { if((ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED) == 0) ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^= CHECKED; @@ -640,11 +499,6 @@ void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c) if(nsoption_bool(kiosk_mode) == true) return; - OffMenu(win,AMI_MENU_CUT); - OffMenu(win,AMI_MENU_COPY); - OffMenu(win,AMI_MENU_PASTE); - OffMenu(win,AMI_MENU_CLEAR); - if(content_get_type(c) <= CONTENT_CSS) { OnMenu(win,AMI_MENU_SAVEAS_TEXT); @@ -656,25 +510,37 @@ void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c) { OnMenu(win,AMI_MENU_COPY); OnMenu(win,AMI_MENU_CLEAR); - - if(browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_CUT) - OnMenu(win,AMI_MENU_CUT); + } else { + OffMenu(win,AMI_MENU_COPY); + OffMenu(win,AMI_MENU_CLEAR); } - if(g->c_h) OnMenu(win,AMI_MENU_PASTE); + + if(browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_CUT) + OnMenu(win,AMI_MENU_CUT); + else + OffMenu(win,AMI_MENU_CUT); + + if(browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_PASTE) + OnMenu(win,AMI_MENU_PASTE); + else + OffMenu(win,AMI_MENU_PASTE); + OnMenu(win,AMI_MENU_SELECTALL); OnMenu(win,AMI_MENU_FIND); OffMenu(win,AMI_MENU_SAVEAS_IFF); } else { + OffMenu(win,AMI_MENU_CUT); + OffMenu(win,AMI_MENU_PASTE); + OffMenu(win,AMI_MENU_CLEAR); + OffMenu(win,AMI_MENU_SAVEAS_TEXT); OffMenu(win,AMI_MENU_SAVEAS_COMPLETE); #ifdef WITH_PDF_EXPORT OffMenu(win,AMI_MENU_SAVEAS_PDF); #endif - OffMenu(win,AMI_MENU_PASTE); OffMenu(win,AMI_MENU_SELECTALL); - OffMenu(win,AMI_MENU_CLEAR); OffMenu(win,AMI_MENU_FIND); #ifdef WITH_NS_SVG @@ -1073,7 +939,7 @@ static void ami_menu_item_settings_snapshot(struct Hook *hook, APTR window, stru static void ami_menu_item_settings_save(struct Hook *hook, APTR window, struct IntuiMessage *msg) { - nsoption_write(current_user_options); + nsoption_write(current_user_options, NULL, NULL); } static void ami_menu_item_arexx_execute(struct Hook *hook, APTR window, struct IntuiMessage *msg) @@ -1083,6 +949,8 @@ static void ami_menu_item_arexx_execute(struct Hook *hook, APTR window, struct I GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); if(AslRequestTags(filereq, + ASLFR_Window, gwin->win, + ASLFR_SleepWindow, TRUE, ASLFR_TitleText, messages_get("NetSurf"), ASLFR_Screen, scrn, ASLFR_DoSaveMode, FALSE, diff --git a/amiga/menu.h b/amiga/menu.h index 8cff2d539..e96fcf0ee 100755 --- a/amiga/menu.h +++ b/amiga/menu.h @@ -23,38 +23,95 @@ #include <libraries/gadtools.h> #include "content/hlcache.h" -/* Number of hotlist items, menu structure needs to be changed in ami_create_menu() - * if this value is changed. */ +/* Maximum number of hotlist items (somewhat arbitrary value) */ #define AMI_HOTLIST_ITEMS 60 -//gwin->hotlist_items -/* Maximum number of menu items - first value is number of static items - * (ie. everything not intially defined as NM_IGNORE) */ -#define AMI_MENU_MAX 57 + AMI_HOTLIST_ITEMS - -/* Where the hotlist entries start */ -#define AMI_MENU_HOTLIST 48 - -/* Where the hotlist entries end */ -#define AMI_MENU_HOTLIST_MAX AMI_MENU_HOTLIST+AMI_HOTLIST_ITEMS - -/* Number of ARexx menu items. menu structure in ami_create_menu() needs to be - * changed if this value is modified. */ +/* Maximum number of ARexx menu items (somewhat arbitrary value) */ #define AMI_MENU_AREXX_ITEMS 20 -/* Where the ARexx menu items start. ARexx menu items are right at the end... - * for now, at least. We can get away with AMI_MENU_MAX falling short as it is - * only used for freeing the UTF-8 converted menu labels */ -#define AMI_MENU_AREXX AMI_MENU_MAX +/* enum menu structure, has to be here as we need it below. */ +enum { + /* Project menu */ + M_PROJECT = 0, + M_NEWWIN, + M_NEWTAB, + M_BAR_P1, + M_OPEN, + M_SAVEAS, + M_SAVESRC, + M_SAVETXT, + M_SAVECOMP, + M_SAVEIFF, +#ifdef WITH_PDF_EXPORT + M_SAVEPDF, +#endif + M_BAR_P2, + M_CLOSETAB, + M_CLOSEWIN, + M_BAR_P3, + M_PRINT, + M_BAR_P4, + M_ABOUT, + M_QUIT, + /* Edit menu */ + M_EDIT, + M_CUT, + M_COPY, + M_PASTE, + M_BAR_E1, + M_SELALL, + M_CLEAR, + /* Browser menu */ + M_BROWSER, + M_FIND, + M_BAR_B1, + M_HISTLOCL, + M_HISTGLBL, + M_BAR_B2, + M_COOKIES, + M_BAR_B3, + M_SCALE, + M_SCALEDEC, + M_SCALENRM, + M_SCALEINC, + M_IMAGES, + M_IMGFORE, + M_IMGBACK, +#if defined(WITH_JS) || defined(WITH_MOZJS) + M_JS, +#endif + M_BAR_B4, + M_REDRAW, + /* Hotlist menu */ + M_HOTLIST, + M_HLADD, + M_HLSHOW, + M_BAR_H1, // 47 + AMI_MENU_HOTLIST, /* Where the hotlist entries start */ + AMI_MENU_HOTLIST_MAX = AMI_MENU_HOTLIST + AMI_HOTLIST_ITEMS, + /* Settings menu */ + M_PREFS, + M_PREDIT, + M_BAR_S1, + M_SNAPSHOT, + M_PRSAVE, + /* ARexx menu */ + M_AREXX, + M_AREXXEX, + M_BAR_A1, + AMI_MENU_AREXX, + AMI_MENU_AREXX_MAX = AMI_MENU_AREXX + AMI_MENU_AREXX_ITEMS +}; -/* Where the ARexx menu items end (incidentally this is the real AMI_MENU_MAX) */ -#define AMI_MENU_AREXX_MAX AMI_MENU_AREXX+AMI_MENU_AREXX_ITEMS +/* We can get away with AMI_MENU_MAX falling short as it is + * only used for freeing the UTF-8 converted menu labels */ +#define AMI_MENU_MAX AMI_MENU_AREXX /* The Intuition menu numbers of some menus we might need to modify */ #define AMI_MENU_SAVEAS_TEXT FULLMENUNUM(0,4,1) #define AMI_MENU_SAVEAS_COMPLETE FULLMENUNUM(0,4,2) -#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,3) -#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,4) +#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,3) +#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,4) #define AMI_MENU_CLOSETAB FULLMENUNUM(0,6,0) #define AMI_MENU_CUT FULLMENUNUM(1,0,0) #define AMI_MENU_COPY FULLMENUNUM(1,1,0) diff --git a/amiga/options.h b/amiga/options.h index 822a7a3aa..b95ddf12d 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -16,207 +16,77 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_ -#error "Frontend options header cannot be included directly" -#endif - #ifndef AMIGA_OPTIONS_H #define AMIGA_OPTIONS_H -#define NSOPTION_EXTRA_DEFINE \ - char *url_file; \ - char *hotlist_file; \ - char *use_pubscreen; \ - char *modeid; \ - int screen_compositing; \ - int amiga_ydpi; \ - int cache_bitmaps; \ - char *theme; \ - bool utf8_clipboard; \ - bool context_menu; \ - bool truecolour_mouse_pointers; \ - bool use_os_pointers; \ - bool use_openurl_lib; \ - bool new_tab_active; \ - bool new_tab_last; \ - bool tab_close_warn; \ - bool tab_always_show; \ - bool kiosk_mode; \ - char *search_engines_file; \ - char *arexx_dir; \ - char *arexx_startup; \ - char *arexx_shutdown; \ - char *download_dir; \ - bool download_notify; \ - bool faster_scroll; \ - bool scale_quality; \ - int dither_quality; \ - int mask_alpha; \ - bool ask_overwrite; \ - int printer_unit; \ - int print_scale; \ - bool startup_no_window; \ - bool close_no_quit; \ - bool hide_docky_icon; \ - char *font_unicode; \ - char *font_unicode_file; \ - bool font_unicode_only; \ - bool font_antialiasing; \ - bool drag_save_icons; \ - int hotlist_window_xpos; \ - int hotlist_window_ypos; \ - int hotlist_window_xsize; \ - int hotlist_window_ysize; \ - int history_window_xpos; \ - int history_window_ypos; \ - int history_window_xsize; \ - int history_window_ysize; \ - int cookies_window_xpos; \ - int cookies_window_ypos; \ - int cookies_window_xsize; \ - int cookies_window_ysize; \ - int web_search_width; \ - int cairo_renderer; \ - bool direct_render; \ - bool window_simple_refresh; \ - bool resize_with_contents; \ - int reformat_delay; \ - int redraw_tile_size_x; \ - int redraw_tile_size_y; \ - int monitor_aspect_x; \ - int monitor_aspect_y; \ - bool accept_lang_locale; \ - int menu_refresh +/* currently nothing here */ + +#endif -#define NSOPTION_EXTRA_DEFAULTS \ - .url_file = NULL, \ - .hotlist_file = NULL, \ - .use_pubscreen = NULL, \ - .modeid = NULL, \ - .screen_compositing = -1, \ - .amiga_ydpi = 85, \ - .cache_bitmaps = 0, \ - .theme = NULL, \ - .utf8_clipboard = false, \ - .context_menu = true, \ - .truecolour_mouse_pointers = false, \ - .use_os_pointers = true, \ - .use_openurl_lib = false, \ - .new_tab_active = false, \ - .new_tab_last = false, \ - .tab_close_warn = true, \ - .tab_always_show = false, \ - .kiosk_mode = false, \ - .search_engines_file = NULL, \ - .arexx_dir = NULL, \ - .arexx_startup = NULL, \ - .arexx_shutdown = NULL, \ - .download_dir = NULL, \ - .download_notify = false, \ - .faster_scroll = true, \ - .scale_quality = false, \ - .dither_quality = 1, \ - .mask_alpha = 50, \ - .ask_overwrite = true, \ - .printer_unit = 0, \ - .print_scale = 100, \ - .startup_no_window = false, \ - .close_no_quit = false, \ - .hide_docky_icon = false, \ - .font_unicode = NULL, \ - .font_unicode_file = NULL, \ - .font_unicode_only = false, \ - .font_antialiasing = true, \ - .drag_save_icons = true, \ - .hotlist_window_xpos = 0, \ - .hotlist_window_ypos = 0, \ - .hotlist_window_xsize = 0, \ - .hotlist_window_ysize = 0, \ - .history_window_xpos = 0, \ - .history_window_ypos = 0, \ - .history_window_xsize = 0, \ - .history_window_ysize = 0, \ - .cookies_window_xpos = 0, \ - .cookies_window_ypos = 0, \ - .cookies_window_xsize = 0, \ - .cookies_window_ysize = 0, \ - .web_search_width = 0, \ - .cairo_renderer = 0, \ - .direct_render = false, \ - .window_simple_refresh = false, \ - .resize_with_contents = false, \ - .reformat_delay = 0, \ - .redraw_tile_size_x = 0, \ - .redraw_tile_size_y = 0, \ - .monitor_aspect_x = 0, \ - .monitor_aspect_y = 0, \ - .accept_lang_locale = true, \ - .menu_refresh = 0 -#define NSOPTION_EXTRA_TABLE \ -{ "url_file", OPTION_STRING, &nsoptions.url_file }, \ -{ "hotlist_file", OPTION_STRING, &nsoptions.hotlist_file }, \ -{ "use_pubscreen", OPTION_STRING, &nsoptions.use_pubscreen}, \ -{ "screen_modeid", OPTION_STRING, &nsoptions.modeid}, \ -{ "screen_compositing", OPTION_INTEGER, &nsoptions.screen_compositing}, \ -{ "screen_ydpi", OPTION_INTEGER, &nsoptions.amiga_ydpi}, \ -{ "cache_bitmaps", OPTION_INTEGER, &nsoptions.cache_bitmaps}, \ -{ "theme", OPTION_STRING, &nsoptions.theme}, \ -{ "clipboard_write_utf8", OPTION_BOOL, &nsoptions.utf8_clipboard}, \ -{ "context_menu", OPTION_BOOL, &nsoptions.context_menu}, \ -{ "truecolour_mouse_pointers", OPTION_BOOL, &nsoptions.truecolour_mouse_pointers}, \ -{ "os_mouse_pointers", OPTION_BOOL, &nsoptions.use_os_pointers}, \ -{ "use_openurl_lib", OPTION_BOOL, &nsoptions.use_openurl_lib}, \ -{ "new_tab_is_active", OPTION_BOOL, &nsoptions.new_tab_active}, \ -{ "new_tab_last", OPTION_BOOL, &nsoptions.new_tab_last}, \ -{ "tab_close_warn", OPTION_BOOL, &nsoptions.tab_close_warn}, \ -{ "tab_always_show", OPTION_BOOL, &nsoptions.tab_always_show}, \ -{ "kiosk_mode", OPTION_BOOL, &nsoptions.kiosk_mode}, \ -{ "search_engines_file",OPTION_STRING, &nsoptions.search_engines_file }, \ -{ "arexx_dir", OPTION_STRING, &nsoptions.arexx_dir }, \ -{ "arexx_startup", OPTION_STRING, &nsoptions.arexx_startup }, \ -{ "arexx_shutdown", OPTION_STRING, &nsoptions.arexx_shutdown }, \ -{ "download_dir", OPTION_STRING, &nsoptions.download_dir }, \ -{ "download_notify", OPTION_BOOL, &nsoptions.download_notify}, \ -{ "faster_scroll", OPTION_BOOL, &nsoptions.faster_scroll}, \ -{ "scale_quality", OPTION_BOOL, &nsoptions.scale_quality}, \ -{ "dither_quality", OPTION_INTEGER, &nsoptions.dither_quality}, \ -{ "mask_alpha", OPTION_INTEGER, &nsoptions.mask_alpha}, \ -{ "ask_overwrite", OPTION_BOOL, &nsoptions.ask_overwrite}, \ -{ "printer_unit", OPTION_INTEGER, &nsoptions.printer_unit}, \ -{ "print_scale", OPTION_INTEGER, &nsoptions.print_scale}, \ -{ "startup_no_window", OPTION_BOOL, &nsoptions.startup_no_window}, \ -{ "close_no_quit", OPTION_BOOL, &nsoptions.close_no_quit}, \ -{ "hide_docky_icon", OPTION_BOOL, &nsoptions.hide_docky_icon}, \ -{ "font_unicode", OPTION_STRING, &nsoptions.font_unicode }, \ -{ "font_unicode_file", OPTION_STRING, &nsoptions.font_unicode_file }, \ -{ "font_unicode_only", OPTION_BOOL, &nsoptions.font_unicode_only }, \ -{ "font_antialiasing", OPTION_BOOL, &nsoptions.font_antialiasing }, \ -{ "drag_save_icons", OPTION_BOOL, &nsoptions.drag_save_icons}, \ -{ "hotlist_window_xpos", OPTION_INTEGER, &nsoptions.hotlist_window_xpos}, \ -{ "hotlist_window_ypos", OPTION_INTEGER, &nsoptions.hotlist_window_ypos}, \ -{ "hotlist_window_xsize", OPTION_INTEGER, &nsoptions.hotlist_window_xsize}, \ -{ "hotlist_window_ysize", OPTION_INTEGER, &nsoptions.hotlist_window_ysize}, \ -{ "history_window_xpos", OPTION_INTEGER, &nsoptions.history_window_xpos}, \ -{ "history_window_ypos", OPTION_INTEGER, &nsoptions.history_window_ypos}, \ -{ "history_window_xsize", OPTION_INTEGER, &nsoptions.history_window_xsize}, \ -{ "history_window_ysize", OPTION_INTEGER, &nsoptions.history_window_ysize}, \ -{ "cookies_window_xpos", OPTION_INTEGER, &nsoptions.cookies_window_xpos}, \ -{ "cookies_window_ypos", OPTION_INTEGER, &nsoptions.cookies_window_ypos}, \ -{ "cookies_window_xsize", OPTION_INTEGER, &nsoptions.cookies_window_xsize}, \ -{ "cookies_window_ysize", OPTION_INTEGER, &nsoptions.cookies_window_ysize}, \ -{ "web_search_width", OPTION_INTEGER, &nsoptions.web_search_width}, \ -{ "cairo_renderer", OPTION_INTEGER, &nsoptions.cairo_renderer}, \ -{ "direct_render", OPTION_BOOL, &nsoptions.direct_render}, \ -{ "window_simple_refresh", OPTION_BOOL, &nsoptions.window_simple_refresh}, \ -{ "resize_with_contents", OPTION_BOOL, &nsoptions.resize_with_contents}, \ -{ "reformat_delay", OPTION_INTEGER, &nsoptions.reformat_delay}, \ -{ "redraw_tile_size_x", OPTION_INTEGER, &nsoptions.redraw_tile_size_x}, \ -{ "redraw_tile_size_y", OPTION_INTEGER, &nsoptions.redraw_tile_size_y}, \ -{ "monitor_aspect_x", OPTION_INTEGER, &nsoptions.monitor_aspect_x}, \ -{ "monitor_aspect_y", OPTION_INTEGER, &nsoptions.monitor_aspect_y}, \ -{ "accept_lang_locale", OPTION_BOOL, &nsoptions.accept_lang_locale}, \ -{ "menu_refresh", OPTION_INTEGER, &nsoptions.menu_refresh} +NSOPTION_STRING(url_file, NULL) +NSOPTION_STRING(hotlist_file, NULL) +NSOPTION_STRING(pubscreen_name, NULL) +NSOPTION_STRING(screen_modeid, NULL) +NSOPTION_INTEGER(screen_compositing, -1) +NSOPTION_INTEGER(screen_ydpi, 85) +NSOPTION_INTEGER(cache_bitmaps, 0) +NSOPTION_STRING(theme, "PROGDIR:Resources/Themes/Default") +NSOPTION_BOOL(clipboard_write_utf8, false) +NSOPTION_BOOL(context_menu, true) +NSOPTION_BOOL(truecolour_mouse_pointers, false) +NSOPTION_BOOL(os_mouse_pointers, true) +NSOPTION_BOOL(use_openurl_lib, false) +NSOPTION_BOOL(new_tab_is_active, false) +NSOPTION_BOOL(new_tab_last, false) +NSOPTION_BOOL(tab_close_warn, true) +NSOPTION_BOOL(tab_always_show, false) +NSOPTION_BOOL(kiosk_mode, false) +NSOPTION_STRING(search_engines_file, "PROGDIR:Resources/SearchEngines") +NSOPTION_STRING(arexx_dir, "Rexx") +NSOPTION_STRING(arexx_startup, "Startup.nsrx") +NSOPTION_STRING(arexx_shutdown, "Shutdown.nsrx") +NSOPTION_STRING(download_dir, NULL) +NSOPTION_BOOL(download_notify, true) +NSOPTION_BOOL(faster_scroll, true) +NSOPTION_BOOL(scale_quality, false) +NSOPTION_INTEGER(dither_quality, 1) +NSOPTION_INTEGER(mask_alpha, 50) +NSOPTION_BOOL(ask_overwrite, true) +NSOPTION_INTEGER(printer_unit, 0) +NSOPTION_INTEGER(print_scale, 100) +NSOPTION_BOOL(startup_no_window, false) +NSOPTION_BOOL(close_no_quit, false) +NSOPTION_BOOL(hide_docky_icon, false) +NSOPTION_STRING(font_unicode, NULL) +NSOPTION_STRING(font_unicode_file, NULL) +NSOPTION_BOOL(font_unicode_only, false) +NSOPTION_BOOL(font_antialiasing, true) +NSOPTION_BOOL(drag_save_icons, true) +NSOPTION_INTEGER(hotlist_window_xpos, 0) +NSOPTION_INTEGER(hotlist_window_ypos, 0) +NSOPTION_INTEGER(hotlist_window_xsize, 0) +NSOPTION_INTEGER(hotlist_window_ysize, 0) +NSOPTION_INTEGER(history_window_xpos, 0) +NSOPTION_INTEGER(history_window_ypos, 0) +NSOPTION_INTEGER(history_window_xsize, 0) +NSOPTION_INTEGER(history_window_ysize, 0) +NSOPTION_INTEGER(cookies_window_xpos, 0) +NSOPTION_INTEGER(cookies_window_ypos, 0) +NSOPTION_INTEGER(cookies_window_xsize, 0) +NSOPTION_INTEGER(cookies_window_ysize, 0) +NSOPTION_INTEGER(web_search_width, 0) +NSOPTION_INTEGER(cairo_renderer, 0) +NSOPTION_BOOL(direct_render, false) +NSOPTION_BOOL(window_simple_refresh, false) +NSOPTION_BOOL(resize_with_contents, false) +NSOPTION_INTEGER(reformat_delay, 0) +NSOPTION_INTEGER(redraw_tile_size_x, 0) +NSOPTION_INTEGER(redraw_tile_size_y, 0) +NSOPTION_INTEGER(monitor_aspect_x, 0) +NSOPTION_INTEGER(monitor_aspect_y, 0) +NSOPTION_BOOL(accept_lang_locale, true) +NSOPTION_INTEGER(menu_refresh, 0) + -#endif diff --git a/amiga/pkg/makepackage b/amiga/pkg/makepackage index dcc130a6a..4f5eb84d8 100755 --- a/amiga/pkg/makepackage +++ b/amiga/pkg/makepackage @@ -27,8 +27,8 @@ makedir ram:NetSurf/SObjs copy sobjs:libjpeg.so.8 sobjs:libcurl.so.7 sobjs:librtmp.so.0 sobjs:libsvgtiny.so.0 sobjs:libssl.so.1.0.0 sobjs:libcrypto.so.1.0.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libpng12.so sobjs:libdom.so.0 sobjs:libhubbub.so.0 ram:NetSurf/SObjs clone ;sobjs:libhpdf-2.2.0.so.0.0 echo "Splitting Messages file" -perl utils/split-messages.pl de ami < resources/FatMessages >RAM:NetSurf/Resources/de/Messages -perl utils/split-messages.pl en ami < resources/FatMessages >RAM:NetSurf/Resources/en/Messages -perl utils/split-messages.pl fr ami < resources/FatMessages >RAM:NetSurf/Resources/fr/Messages -perl utils/split-messages.pl it ami < resources/FatMessages >RAM:NetSurf/Resources/it/Messages -perl utils/split-messages.pl nl ami < resources/FatMessages >RAM:NetSurf/Resources/nl/Messages +perl utils/split-messages.pl -l de -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/de/Messages +perl utils/split-messages.pl -l en -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/en/Messages +perl utils/split-messages.pl -l fr -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/fr/Messages +perl utils/split-messages.pl -l it -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/it/Messages +perl utils/split-messages.pl -l nl -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/nl/Messages diff --git a/amiga/plotters.c b/amiga/plotters.c index ace3c3b53..bf1c2bf69 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -22,7 +22,8 @@ #include "amiga/gui.h" #include "amiga/utf8.h" -#include "desktop/options.h" +#include "css/utils.h" +#include "utils/nsoption.h" #include "utils/utils.h" #include "utils/log.h" @@ -101,17 +102,6 @@ const struct plotter_table amiplot = { .option_knockout = true, }; -colour ami_abgr_to_argb(colour c) { - colour argb = 0x00000000; - - /* NB: We force the alpha byte to be 0xff, as it is not set by the core. */ - argb = 0xff000000 | - ((c & 0x00ff0000) >> 16) | - (c & 0x0000ff00) | - ((c & 0x000000ff) << 16); - - return argb; -} #ifdef NS_AMIGA_CAIRO void ami_cairo_set_colour(cairo_t *cr,colour c) @@ -155,19 +145,15 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) * Also applies to the further gfx/layers functions and memory below */ ULONG depth = 32; - struct DrawInfo *dri; - struct BitMap *friend = NULL; /* Required to be NULL for Cairo and ARGB bitmaps */ + struct BitMap *friend = NULL; depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH); if((depth < 16) || (nsoption_int(cairo_renderer) == -1)) { palette_mapped = true; - // friend = scrn->RastPort.BitMap; } else { palette_mapped = false; } - if(nsoption_int(redraw_tile_size_x) <= 0) nsoption_set_int(redraw_tile_size_x, scrn->Width); - if(nsoption_int(redraw_tile_size_y) <= 0) nsoption_set_int(redraw_tile_size_y, scrn->Height); if(!width) width = nsoption_int(redraw_tile_size_x); if(!height) height = nsoption_int(redraw_tile_size_y); @@ -297,7 +283,7 @@ static void ami_plot_setapen(ULONG colour) { if(palette_mapped == false) { SetRPAttrs(glob->rp, RPTAG_APenColor, - ami_abgr_to_argb(colour), + ns_color_to_nscss(colour), TAG_DONE); } else { ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour); @@ -309,7 +295,7 @@ static void ami_plot_setopen(ULONG colour) { if(palette_mapped == false) { SetRPAttrs(glob->rp, RPTAG_OPenColor, - ami_abgr_to_argb(colour), + ns_color_to_nscss(colour), TAG_DONE); } else { ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour); diff --git a/amiga/print.c b/amiga/print.c index ec04c6229..f0689f73a 100644 --- a/amiga/print.c +++ b/amiga/print.c @@ -20,7 +20,7 @@ #include "amiga/plotters.h" #include "render/font.h" #include "amiga/gui.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "amiga/print.h" #include "utils/messages.h" #include "utils/utils.h" diff --git a/amiga/search.c b/amiga/search.c index 12fe582cb..18ea27fce 100755 --- a/amiga/search.c +++ b/amiga/search.c @@ -29,7 +29,6 @@ #include "desktop/browser.h" #include "desktop/gui.h" #include "desktop/search.h" -#include "desktop/selection.h" #include "utils/log.h" #include "utils/messages.h" #include "utils/utils.h" @@ -86,15 +85,11 @@ static struct gui_search_callbacks ami_search_callbacks = { */ void ami_search_open(struct gui_window *gwin) { - if (browser_window_search_create_context(gwin->shared->bw, - &ami_search_callbacks, NULL) == false) - return; - search_insert = true; if(fwin) { - browser_window_search_destroy_context(fwin->gwin->shared->bw); + browser_window_search_clear(fwin->gwin->shared->bw); ami_search_set_forward_state(true, NULL); ami_search_set_back_state(true, NULL); fwin->gwin->shared->searchwin = NULL; @@ -181,7 +176,7 @@ void ami_search_open(struct gui_window *gwin) void ami_search_close(void) { - browser_window_search_destroy_context(fwin->gwin->shared->bw); + browser_window_search_clear(fwin->gwin->shared->bw); ami_search_set_forward_state(true, NULL); ami_search_set_back_state(true, NULL); fwin->gwin->shared->searchwin = NULL; @@ -206,7 +201,7 @@ BOOL ami_search_event(void) switch(result & WMHI_GADGETMASK) { case GID_SEARCHSTRING: - browser_window_search_destroy_context( + browser_window_search_clear( fwin->gwin->shared->bw); ami_search_set_forward_state( true, NULL); @@ -229,13 +224,10 @@ BOOL ami_search_event(void) search_insert = true; flags = SEARCH_FLAG_FORWARDS | ami_search_flags(); - if (browser_window_search_verify_new( + browser_window_search( fwin->gwin->shared->bw, - &ami_search_callbacks, NULL)) - browser_window_search_step( - fwin->gwin->shared->bw, - flags, - ami_search_string()); + &ami_search_callbacks, NULL, + flags, ami_search_string()); ActivateWindow(fwin->gwin->shared->win); break; @@ -243,13 +235,10 @@ BOOL ami_search_event(void) search_insert = true; flags = ~SEARCH_FLAG_FORWARDS & ami_search_flags(); - if (browser_window_search_verify_new( + browser_window_search( fwin->gwin->shared->bw, - &ami_search_callbacks, NULL)) - browser_window_search_step( - fwin->gwin->shared->bw, - flags, - ami_search_string()); + &ami_search_callbacks, NULL, + flags, ami_search_string()); ActivateWindow(fwin->gwin->shared->win); break; } diff --git a/amiga/stringview/urlhistory.c b/amiga/stringview/urlhistory.c index ec56987f9..fa5aec448 100644 --- a/amiga/stringview/urlhistory.c +++ b/amiga/stringview/urlhistory.c @@ -29,7 +29,7 @@ #include "urlhistory.h" #include "content/urldb.h" -#include "desktop/options.h" +#include "utils/nsoption.h" static struct List PageList; diff --git a/amiga/system_colour.c b/amiga/system_colour.c deleted file mode 100644 index c9be5ad4c..000000000 --- a/amiga/system_colour.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@netsurf-browser.org> - * - * 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/>. - */ - -/** \file - * System colour handling - * - */ - -#include "amiga/gui.h" -#include "utils/utils.h" -#include "utils/log.h" -#include "desktop/gui.h" -#include "desktop/options.h" -#include "desktop/tree.h" - -#include <proto/graphics.h> -#include <proto/intuition.h> -#include <proto/Picasso96API.h> -#include <intuition/gui.h> -#include <intuition/screens.h> - -#define AMINS_SCROLLERPEN NUMDRIPENS - -struct gui_system_colour_ctx { - const char *name; - int length; - css_color colour; - colour *option_colour; - UWORD amiga_pen; - lwc_string *lwcstr; -}; - -static struct gui_system_colour_ctx colour_list[] = { - { - "ActiveBorder", - SLEN("ActiveBorder"), - 0xff000000, - &nsoption_colour(sys_colour_ActiveBorder), - FILLPEN, - NULL - }, { - "ActiveCaption", - SLEN("ActiveCaption"), - 0xffdddddd, - &nsoption_colour(sys_colour_ActiveCaption), - FILLPEN, - NULL - }, { - "AppWorkspace", - SLEN("AppWorkspace"), - 0xffeeeeee, - &nsoption_colour(sys_colour_AppWorkspace), - BACKGROUNDPEN, - NULL - }, { - "Background", - SLEN("Background"), - 0xff0000aa, - &nsoption_colour(sys_colour_Background), - BACKGROUNDPEN, - NULL - }, { - "ButtonFace", - SLEN("ButtonFace"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_ButtonFace), - FOREGROUNDPEN, - NULL - }, { - "ButtonHighlight", - SLEN("ButtonHighlight"), - 0xffdddddd, - &nsoption_colour(sys_colour_ButtonHighlight), - FORESHINEPEN, - NULL - }, { - "ButtonShadow", - SLEN("ButtonShadow"), - 0xffbbbbbb, - &nsoption_colour(sys_colour_ButtonShadow), - FORESHADOWPEN, - NULL - }, { - "ButtonText", - SLEN("ButtonText"), - 0xff000000, - &nsoption_colour(sys_colour_ButtonText), - TEXTPEN, - NULL - }, { - "CaptionText", - SLEN("CaptionText"), - 0xff000000, - &nsoption_colour(sys_colour_CaptionText), - FILLTEXTPEN, - NULL - }, { - "GrayText", - SLEN("GrayText"), - 0xffcccccc, - &nsoption_colour(sys_colour_GrayText), - DISABLEDTEXTPEN, - NULL - }, { - "Highlight", - SLEN("Highlight"), - 0xff0000ee, - &nsoption_colour(sys_colour_Highlight), - SELECTPEN, - NULL - }, { - "HighlightText", - SLEN("HighlightText"), - 0xff000000, - &nsoption_colour(sys_colour_HighlightText), - SELECTTEXTPEN, - NULL - }, { - "InactiveBorder", - SLEN("InactiveBorder"), - 0xffffffff, - &nsoption_colour(sys_colour_InactiveBorder), - INACTIVEFILLPEN, - NULL - }, { - "InactiveCaption", - SLEN("InactiveCaption"), - 0xffffffff, - &nsoption_colour(sys_colour_InactiveCaption), - INACTIVEFILLPEN, - NULL - }, { - "InactiveCaptionText", - SLEN("InactiveCaptionText"), - 0xffcccccc, - &nsoption_colour(sys_colour_InactiveCaptionText), - INACTIVEFILLTEXTPEN, - NULL - }, { - "InfoBackground", - SLEN("InfoBackground"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_InfoBackground), - BACKGROUNDPEN, /* This is wrong, HelpHint backgrounds are pale yellow but doesn't seem to be a DrawInfo pen defined for it. */ - NULL - }, { - "InfoText", - SLEN("InfoText"), - 0xff000000, - &nsoption_colour(sys_colour_InfoText), - TEXTPEN, - NULL - }, { - "Menu", - SLEN("Menu"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_Menu), - MENUBACKGROUNDPEN, - NULL - }, { - "MenuText", - SLEN("MenuText"), - 0xff000000, - &nsoption_colour(sys_colour_MenuText), - MENUTEXTPEN, - NULL - }, { - "Scrollbar", - SLEN("Scrollbar"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_Scrollbar), - AMINS_SCROLLERPEN, - NULL - }, { - "ThreeDDarkShadow", - SLEN("ThreeDDarkShadow"), - 0xff555555, - &nsoption_colour(sys_colour_ThreeDDarkShadow), - FORESHADOWPEN, - NULL - }, { - "ThreeDFace", - SLEN("ThreeDFace"), - 0xffdddddd, - &nsoption_colour(sys_colour_ThreeDFace), - FOREGROUNDPEN, - NULL - }, { - "ThreeDHighlight", - SLEN("ThreeDHighlight"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_ThreeDHighlight), - FORESHINEPEN, - NULL - }, { - "ThreeDLightShadow", - SLEN("ThreeDLightShadow"), - 0xff999999, - &nsoption_colour(sys_colour_ThreeDLightShadow), - HALFSHINEPEN, - NULL - }, { - "ThreeDShadow", - SLEN("ThreeDShadow"), - 0xff777777, - &nsoption_colour(sys_colour_ThreeDShadow), - HALFSHADOWPEN, - NULL - }, { - "Window", - SLEN("Window"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_Window), - BACKGROUNDPEN, - NULL - }, { - "WindowFrame", - SLEN("WindowFrame"), - 0xff000000, - &nsoption_colour(sys_colour_WindowFrame), - INACTIVEFILLPEN, - NULL - }, { - - "WindowText", - SLEN("WindowText"), - 0xff000000, - &nsoption_colour(sys_colour_WindowText), - TEXTPEN, - NULL - }, - -}; - -#define colour_list_len (sizeof(colour_list) / sizeof(struct gui_system_colour_ctx)) - -static struct gui_system_colour_ctx *gui_system_colour_pw = NULL; - -css_color ami_css_colour_from_pen(struct Screen *screen, UWORD pen); - -UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo) -{ - LONG scrollerfillpen = FALSE; - - GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE); - - if(scrollerfillpen) return FILLPEN; - else return FOREGROUNDPEN; -} - -bool gui_system_colour_init(void) -{ - unsigned int ccount; - - if (gui_system_colour_pw != NULL) - return false; - - /* Intern colour strings */ - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (lwc_intern_string(colour_list[ccount].name, - colour_list[ccount].length, - &(colour_list[ccount].lwcstr)) != lwc_error_ok) { - return false; - } - } - - /* pull in options if set (ie not transparent) */ - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (*(colour_list[ccount].option_colour) != 0) { - colour_list[ccount].colour = *(colour_list[ccount].option_colour); - } - else if(scrn) { - colour_list[ccount].colour = - ami_css_colour_from_pen(scrn, colour_list[ccount].amiga_pen); - } - } - - gui_system_colour_pw = colour_list; - tree_setup_colours(); - - return true; -} - -void gui_system_colour_finalize(void) -{ - unsigned int ccount; - - for (ccount = 0; ccount < colour_list_len; ccount++) { - lwc_string_unref(colour_list[ccount].lwcstr); - } - - gui_system_colour_pw = NULL; -} - -colour ami_css_color_to_colour(css_color c) -{ - return (c & 0xFF00FF00) | ((c >> 16) & 0xFF) | ((c & 0xFF) << 16); -} - -colour gui_system_colour_char(const char *name) -{ - colour ret = 0xff00000; - unsigned int ccount; - - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (strcmp(name, colour_list[ccount].name) == 0) { - ret = ami_css_color_to_colour(colour_list[ccount].colour); - break; - } - } - return ret; -} - -css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour) -{ - unsigned int ccount; - bool match; - - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (lwc_string_caseless_isequal(name, - colour_list[ccount].lwcstr, - &match) == lwc_error_ok && match) { - *colour = colour_list[ccount].colour; - return CSS_OK; - } - } - - return CSS_INVALID; -} - -css_color ami_css_colour_from_pen(struct Screen *screen, UWORD pen) -{ - css_color css_colour = 0x00000000; - ULONG colour[3]; - struct DrawInfo *drinfo = GetScreenDrawInfo(screen); - - if(drinfo == NULL) return 0x00000000; - - if(pen == AMINS_SCROLLERPEN) pen = ami_system_colour_scrollbar_fgpen(drinfo); - - /* Get the colour of the pen being used for "pen" */ - GetRGB32(screen->ViewPort.ColorMap, drinfo->dri_Pens[pen], 1, (ULONG *)&colour); - - /* convert it to a css_color */ - css_colour = (0xff << 24) | - ((colour[0] & 0xff000000) >> 8) | - ((colour[1] & 0xff000000) >> 16) | - ((colour[2] & 0xff000000) >> 24); - - FreeScreenDrawInfo(screen, drinfo); - return css_colour; -} diff --git a/amiga/theme.c b/amiga/theme.c index fa058e043..a0755b23a 100644 --- a/amiga/theme.c +++ b/amiga/theme.c @@ -37,7 +37,7 @@ #include "amiga/bitmap.h" #include "amiga/drag.h" #include "desktop/browser_private.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "amiga/theme.h" #include "desktop/searchweb.h" #include "utils/messages.h" @@ -193,7 +193,7 @@ void ami_update_pointer(struct Window *win, gui_pointer_shape shape) { if(drag_save_data) return; - if(nsoption_bool(use_os_pointers)) + if(nsoption_bool(os_mouse_pointers)) { switch(shape) { diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c index f1738d29d..61102feff 100755 --- a/amiga/thumbnail.c +++ b/amiga/thumbnail.c @@ -20,7 +20,7 @@ #include "desktop/browser.h" #include "amiga/gui.h" #include "amiga/bitmap.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "content/urldb.h" #include "desktop/plotters.h" #include "desktop/thumbnail.h" diff --git a/amiga/tree.c b/amiga/tree.c index 9c7b9d66b..ddaf81ebc 100644 --- a/amiga/tree.c +++ b/amiga/tree.c @@ -53,7 +53,7 @@ #include "amiga/drag.h" /* drag icon stuff */ #include "amiga/theme.h" /* pointers */ #include "amiga/filetype.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "content/urldb.h" #include "desktop/cookies.h" #include "desktop/history_global_core.h" @@ -1000,6 +1000,8 @@ BOOL ami_tree_event(struct treeview_window *twin) { case 0: // export if(AslRequestTags(savereq, + ASLFR_Window, twin->win, + ASLFR_SleepWindow, TRUE, ASLFR_TitleText,messages_get("NetSurf"), ASLFR_Screen,scrn, ASLFR_InitialFile,"tree_export.html", diff --git a/amiga/version.c b/amiga/version.c index 85546619b..c3244ac0a 100644 --- a/amiga/version.c +++ b/amiga/version.c @@ -24,7 +24,7 @@ * desktop/version.c. */ #define NETSURF_VERSION_MAJOR "3" -#define NETSURF_VERSION_MINOR "1" +#define NETSURF_VERSION_MINOR "2" static const __attribute__((used)) char *verstag = "\0$VER: NetSurf " NETSURF_VERSION_MAJOR "." NETSURF_VERSION_MINOR " (" WT_COMPILEDATE ")\0"; const char * const verdate = WT_COMPILEDATE; |