diff options
Diffstat (limited to 'amiga')
-rw-r--r-- | amiga/Makefile.target | 10 | ||||
-rw-r--r-- | amiga/arexx.c | 2 | ||||
-rw-r--r-- | amiga/bitmap.c | 2 | ||||
-rw-r--r-- | amiga/clipboard.c | 6 | ||||
-rw-r--r-- | amiga/context_menu.c | 4 | ||||
-rw-r--r-- | amiga/download.c | 6 | ||||
-rw-r--r-- | amiga/drag.c | 2 | ||||
-rw-r--r-- | amiga/file.c | 8 | ||||
-rwxr-xr-x | amiga/font.c | 15 | ||||
-rw-r--r-- | amiga/font_scan.c | 2 | ||||
-rw-r--r-- | amiga/gui.c | 181 | ||||
-rwxr-xr-x | amiga/gui_options.c | 39 | ||||
-rwxr-xr-x | amiga/launch.c | 2 | ||||
-rw-r--r-- | amiga/menu.c | 6 | ||||
-rw-r--r-- | amiga/options.h | 264 | ||||
-rwxr-xr-x | amiga/plotters.c | 18 | ||||
-rw-r--r-- | amiga/print.c | 2 | ||||
-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 |
22 files changed, 279 insertions, 669 deletions
diff --git a/amiga/Makefile.target b/amiga/Makefile.target index b51a1fafa..33ce41e62 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -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)) diff --git a/amiga/arexx.c b/amiga/arexx.c index 491fc03bd..5ff7792c0 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" 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 2a4f2ab56..fd42f4d61 100644 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -19,7 +19,7 @@ #include "desktop/gui.h" #include "desktop/plotters.h" #include "desktop/textinput.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "amiga/bitmap.h" #include "amiga/clipboard.h" @@ -238,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))) { @@ -254,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 c6c9be899..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" @@ -728,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/download.c b/amiga/download.c index e461c5f36..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" @@ -105,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), @@ -351,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 c8b44165d..be4d4903d 100644 --- a/amiga/drag.c +++ b/amiga/drag.c @@ -37,7 +37,7 @@ #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 "utils/errors.h" diff --git a/amiga/file.c b/amiga/file.c index 49c0afebf..694285738 100644 --- a/amiga/file.c +++ b/amiga/file.c @@ -29,7 +29,7 @@ #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" @@ -83,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, @@ -213,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; } @@ -229,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 5ec52032f..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 */ @@ -347,11 +349,10 @@ bool nsfont_split(const plot_font_style_t *fstyle, free(outf16); return true; } - - tx += tempx; + utf16 = utf16next; utf8_pos = utf8_next(string, length, utf8_pos); - } + }; free(outf16); @@ -881,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 97e45e54b..b1786ce46 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -23,7 +23,7 @@ #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" @@ -102,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> @@ -131,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 */ @@ -307,9 +311,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)); @@ -391,7 +392,80 @@ 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(struct nsoption_s *opts, + UWORD pen, + enum nsoption_e option, + colour def_colour) +{ + ULONG colour[3]; + struct DrawInfo *drinfo; + + if((option < NSOPTION_SYS_COLOUR_START) || + (option > NSOPTION_SYS_COLOUR_END) || + (opts[option].type != OPTION_COLOUR)) { + return NSERROR_BAD_PARAMETER; + } + + if(scrn != NULL) { + drinfo = GetScreenDrawInfo(scrn); + 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(scrn->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(scrn, drinfo); + } + } + + opts[option].value.c = def_colour; + + return NSERROR_OK; +} + +static void ami_set_screen_defaults(struct Screen *scrn) +{ + if((nsoption_int(window_x) == 0) && + (nsoption_int(window_y) == 0) && + (nsoption_int(window_width) == 0) && + (nsoption_int(window_height) == 0)) { + nsoption_set_int(window_x, 0); + nsoption_set_int(window_y, scrn->BarHeight + 1); + nsoption_set_int(window_width, scrn->Width); + nsoption_set_int(window_height, scrn->Height - scrn->BarHeight - 1); + } + + /* TODO: Update screen colour defaults here */ +} + + +/** + * 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; @@ -440,9 +514,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); @@ -474,24 +545,46 @@ 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 + + /* set system colours for amiga ui */ + colour_option_from_pen(defaults, FILLPEN, NSOPTION_sys_colour_ActiveBorder, 0x00000000); + colour_option_from_pen(defaults, FILLPEN, NSOPTION_sys_colour_ActiveCaption, 0x00dddddd); + colour_option_from_pen(defaults, BACKGROUNDPEN, NSOPTION_sys_colour_AppWorkspace, 0x00eeeeee); + colour_option_from_pen(defaults, BACKGROUNDPEN, NSOPTION_sys_colour_Background, 0x00aa0000); + colour_option_from_pen(defaults, FOREGROUNDPEN, NSOPTION_sys_colour_ButtonFace, 0x00aaaaaa); + colour_option_from_pen(defaults, FORESHINEPEN, NSOPTION_sys_colour_ButtonHighlight, 0x00cccccc); + colour_option_from_pen(defaults, FORESHADOWPEN, NSOPTION_sys_colour_ButtonShadow, 0x00bbbbbb); + colour_option_from_pen(defaults, TEXTPEN, NSOPTION_sys_colour_ButtonText, 0x00000000); + colour_option_from_pen(defaults, FILLTEXTPEN, NSOPTION_sys_colour_CaptionText, 0x00000000); + colour_option_from_pen(defaults, DISABLEDTEXTPEN, NSOPTION_sys_colour_GrayText, 0x00777777); + colour_option_from_pen(defaults, SELECTPEN, NSOPTION_sys_colour_Highlight, 0x00ee0000); + colour_option_from_pen(defaults, SELECTTEXTPEN, NSOPTION_sys_colour_HighlightText, 0x00000000); + colour_option_from_pen(defaults, INACTIVEFILLPEN, NSOPTION_sys_colour_InactiveBorder, 0x00000000); + colour_option_from_pen(defaults, INACTIVEFILLPEN, NSOPTION_sys_colour_InactiveCaption, 0x00ffffff); + colour_option_from_pen(defaults, INACTIVEFILLTEXTPEN, NSOPTION_sys_colour_InactiveCaptionText, 0x00cccccc); + colour_option_from_pen(defaults, BACKGROUNDPEN, NSOPTION_sys_colour_InfoBackground, 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(defaults, TEXTPEN, NSOPTION_sys_colour_InfoText, 0x00000000); + colour_option_from_pen(defaults, MENUBACKGROUNDPEN, NSOPTION_sys_colour_Menu, 0x00aaaaaa); + colour_option_from_pen(defaults, MENUTEXTPEN, NSOPTION_sys_colour_MenuText, 0x00000000); + colour_option_from_pen(defaults, AMINS_SCROLLERPEN, NSOPTION_sys_colour_Scrollbar, 0x00aaaaaa); + colour_option_from_pen(defaults, FORESHADOWPEN, NSOPTION_sys_colour_ThreeDDarkShadow, 0x00555555); + colour_option_from_pen(defaults, FOREGROUNDPEN, NSOPTION_sys_colour_ThreeDFace, 0x00dddddd); + colour_option_from_pen(defaults, FORESHINEPEN, NSOPTION_sys_colour_ThreeDHighlight, 0x00aaaaaa); + colour_option_from_pen(defaults, HALFSHINEPEN, NSOPTION_sys_colour_ThreeDLightShadow, 0x00999999); + colour_option_from_pen(defaults, HALFSHADOWPEN, NSOPTION_sys_colour_ThreeDShadow, 0x00777777); + colour_option_from_pen(defaults, BACKGROUNDPEN, NSOPTION_sys_colour_Window, 0x00aaaaaa); + colour_option_from_pen(defaults, INACTIVEFILLPEN, NSOPTION_sys_colour_WindowFrame, 0x00000000); + colour_option_from_pen(defaults, TEXTPEN, NSOPTION_sys_colour_WindowText, 0x00000000); + + return NSERROR_OK; } void ami_amiupdate(void) @@ -553,13 +646,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; @@ -606,10 +692,10 @@ void ami_openscreen(void) if (nsoption_charp(use_pubscreen) == 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 { @@ -625,8 +711,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); } @@ -672,8 +758,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); } @@ -905,7 +990,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); @@ -917,9 +1002,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); @@ -929,7 +1011,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(); @@ -3118,7 +3219,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, @@ -3131,7 +3232,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); @@ -3668,7 +3769,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)); diff --git a/amiga/gui_options.c b/amiga/gui_options.c index 96ac2e416..1c06e34a3 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> @@ -435,9 +435,10 @@ 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)) @@ -579,7 +580,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, @@ -743,7 +744,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, @@ -942,7 +943,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 +1164,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 +1275,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 +1532,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)); @@ -1590,7 +1591,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 +1615,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); @@ -1667,7 +1668,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 +1741,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 +1785,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); @@ -1868,7 +1869,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 */ } 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 0d1925b8c..d5e67b9f1 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -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" @@ -966,7 +966,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) @@ -976,6 +976,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/options.h b/amiga/options.h index 822a7a3aa..a9278e759 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(use_pubscreen, 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/plotters.c b/amiga/plotters.c index 4d2983076..d95915cc5 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) @@ -295,7 +285,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); @@ -307,7 +297,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/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", |