netsurf: branch mono/removing-windom-dependency updated. a2cbfced0ff3e8b2c7f6fe0ec89c5095e45d4cf4
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a2cbfced0ff3e8b2c7f6f...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a2cbfced0ff3e8b2c7f6fe0...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a2cbfced0ff3e8b2c7f6fe0ec...
The branch, mono/removing-windom-dependency has been updated
via a2cbfced0ff3e8b2c7f6fe0ec89c5095e45d4cf4 (commit)
from f7ee2a03876bf4a5cf66b3a433955e4e55d91362 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/a2cbfced0ff3e8b2c7f...
commit a2cbfced0ff3e8b2c7f6fe0ec89c5095e45d4cf4
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Display current setting values.
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index 9c341ba..f931e62 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -51,6 +51,9 @@ OBJECT *get_tree( int idx );
# define MIN(_a,_b) ((_a<_b) ? _a : _b)
#endif
+#ifndef SET_BIT
+# define SET_BIT(field,bit,val) field = (val)?((field)|(bit)):((field) & ~(bit))
+#endif
/* -------------------------------------------------------------------------- */
/* MultiTOS Drag & Drop */
@@ -91,6 +94,8 @@ short msg_box_show(short type, const char * msg);
#define GW_STATUS_ICONIFIED 0x01
#define GW_STATUS_SHADED 0x02
+#define GW_XTYPE_CHECKBOX (101 << 8)
+
#define GUIWIN_VSLIDER 0x01
#define GUIWIN_HSLIDER 0x02
#define GUIWIN_VH_SLIDER 0x03
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index da3d251..3844f5a 100755
Binary files a/atari/res/netsurf.rsc and b/atari/res/netsurf.rsc differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 5ad6b90..70426ba 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -137,69 +137,46 @@
#define CHOICES_REG_PATH 5 /* BUTTON in tree CHOICES */
#define CHOICES_REG_CACHE 6 /* BUTTON in tree CHOICES */
#define CHOICES_TAB_STYLE 7 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_DEF_FONT_SIZE 10 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_DEF_FONT_SIZE 11 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_DEF_FONT_SIZE 12 /* BOXCHAR in tree CHOICES */
-#define CHOICES_EDIT_MIN_FONT_SIZE 16 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_MIN_FONT_SIZE 17 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_MIN_FONT_SIZE 18 /* BOXCHAR in tree CHOICES */
-#define CHOICES_BT_TOOLBAR_ICONSET 22 /* BUTTON in tree CHOICES */
-#define CHOICES_INPUT_TOOLBAR_BGCOLOR 24 /* FTEXT in tree CHOICES */
-#define CHOICES_TAB_RENDER 25 /* BUTTON in tree CHOICES */
-/* Make sure that initial value is large enough! */
-#define CHOICES_BT_SEL_FONT_RENDERER 26 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_TRANSPARENCY 28 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_ENABLE_ANIMATION 30 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_MIN_GIF_DELAY 33 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_GIF_DELAY 34 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_GIF_DELAY 35 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_INCREMENTAL_REFLOW 37 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_MIN_REFLOW_PERIOD 39 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_INCREMENTAL_REFLOW 40 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_INCREMENTAL_REFLOW 41 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_ANTI_ALIASING 43 /* BUTTON in tree CHOICES */
-#define CHOICES_TAB_PATH 44 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_CA_CERTS_PATH 49 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_DOWNLOAD_PATH 50 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_HOTLIST_FILE 51 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_CA_BUNDLE 52 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_EDITOR 53 /* FTEXT in tree CHOICES */
-#define CHOICES_TAB_CACHE 55 /* BUTTON in tree CHOICES */
-#define CHOICES_INC_MEM_CACHE 59 /* BOXCHAR in tree CHOICES */
-#define CHOICES_DEC_MEM_CACHE 60 /* BOXCHAR in tree CHOICES */
-#define CHOICES_STR_MAX_MEM_CACHE 61 /* STRING in tree CHOICES */
-#define CHOICES_TAB_BROWSER 62 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_HIDE_ADVERTISEMENT 64 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_DISABLE_POPUP_WINDOWS 65 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_SEND_DO_NOT_TRACK 66 /* BUTTON in tree CHOICES */
-#define CHOICES_BT_SEL_LOCALE 68 /* BUTTON in tree CHOICES */
-#define CHOICES_BT_GUI_LANG 71 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_HISTORY_AGE 74 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_HISTORY_AGE 75 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_HISTORY_AGE 76 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_SEND_HTTP_REFERRER 80 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_HOMEPAGE 81 /* FTEXT in tree CHOICES */
-#define CHOICES_BT_CLEAR_HISTORY 82 /* BUTTON in tree CHOICES */
-#define CHOICES_TAB_NETWORK 83 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_USE_PROXY 85 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_PROXY_HOST 86 /* FTEXT in tree CHOICES */
-#define CHOICES_CB_PROXY_AUTH 87 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_PROXY_USERNAME 88 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_PROXY_PASSWORD 89 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_PROXY_PORT 91 /* FTEXT in tree CHOICES */
-#define CHOICES_INC_MAX_FETCHERS_PER_HOST 96 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_CACHED_CONNECTIONS 97 /* BOXCHAR in tree CHOICES */
-#define CHOICES_DEC_MAX_FETCHERS_PER_HOST 98 /* BOXCHAR in tree CHOICES */
-#define CHOICES_DEC_CACHED_CONNECTIONS 99 /* BOXCHAR in tree CHOICES */
-#define CHOICES_EDIT_MAX_FETCHERS_PER_HOST 100 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_MAX_CACHED_CONNECTIONS 101 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_MAX_FETCHERS 103 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_MAX_FETCHERS 104 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_MAX_FETCHERS 105 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_FG_IMAGES 106 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_BG_IMAGES 107 /* BUTTON in tree CHOICES */
-#define CHOICES_ABORT 108 /* BUTTON in tree CHOICES */
-#define CHOICES_OK 109 /* BUTTON in tree CHOICES */
+#define CHOICES_BT_TOOLBAR_ICONSET 11 /* BUTTON in tree CHOICES */
+#define CHOICES_INPUT_TOOLBAR_BGCOLOR 13 /* FTEXT in tree CHOICES */
+#define CHOICES_TAB_RENDER 14 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_TRANSPARENCY 15 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_ENABLE_ANIMATION 17 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_INCREMENTAL_REFLOW 18 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_MIN_REFLOW_PERIOD 20 /* FTEXT in tree CHOICES */
+#define CHOICES_DEC_INCREMENTAL_REFLOW 21 /* BOXCHAR in tree CHOICES */
+#define CHOICES_INC_INCREMENTAL_REFLOW 22 /* BOXCHAR in tree CHOICES */
+#define CHOICES_TAB_PATH 24 /* BUTTON in tree CHOICES */
+#define CHOICES_TAB_CACHE 25 /* BUTTON in tree CHOICES */
+#define CHOICES_INC_MEM_CACHE 29 /* BOXCHAR in tree CHOICES */
+#define CHOICES_DEC_MEM_CACHE 30 /* BOXCHAR in tree CHOICES */
+#define CHOICES_STR_MAX_MEM_CACHE 31 /* STRING in tree CHOICES */
+#define CHOICES_TAB_BROWSER 32 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_HIDE_ADVERTISEMENT 34 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_DISABLE_POPUP_WINDOWS 35 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_SEND_DO_NOT_TRACK 36 /* BUTTON in tree CHOICES */
+#define CHOICES_BT_SEL_LOCALE 38 /* BUTTON in tree CHOICES */
+#define CHOICES_BT_GUI_LANG 41 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_HISTORY_AGE 44 /* FTEXT in tree CHOICES */
+#define CHOICES_DEC_HISTORY_AGE 45 /* BOXCHAR in tree CHOICES */
+#define CHOICES_INC_HISTORY_AGE 46 /* BOXCHAR in tree CHOICES */
+#define CHOICES_CB_SEND_HTTP_REFERRER 50 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_HOMEPAGE 51 /* FTEXT in tree CHOICES */
+#define CHOICES_BT_CLEAR_HISTORY 52 /* BUTTON in tree CHOICES */
+#define CHOICES_TAB_NETWORK 53 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_USE_PROXY 55 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_PROXY_HOST 56 /* FTEXT in tree CHOICES */
+#define CHOICES_CB_PROXY_AUTH 57 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_PROXY_USERNAME 58 /* FTEXT in tree CHOICES */
+#define CHOICES_EDIT_PROXY_PASSWORD 59 /* FTEXT in tree CHOICES */
+#define CHOICES_EDIT_PROXY_PORT 61 /* FTEXT in tree CHOICES */
+#define CHOICES_EDIT_MAX_FETCHERS 66 /* FTEXT in tree CHOICES */
+#define CHOICES_INC_MAX_FETCHERS 67 /* BOXCHAR in tree CHOICES */
+#define CHOICES_DEC_MAX_FETCHERS 68 /* BOXCHAR in tree CHOICES */
+#define CHOICES_CB_FG_IMAGES 69 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_BG_IMAGES 70 /* BUTTON in tree CHOICES */
+#define CHOICES_ABORT 72 /* BUTTON in tree CHOICES */
+#define CHOICES_OK 73 /* BUTTON in tree CHOICES */
#define VSCROLLER 14 /* form/dial */
#define VSCROLLER_AREA 1 /* BOX in tree VSCROLLER */
@@ -211,18 +188,64 @@
#define VSCROLLER_BT_UP_PIC 4 /* CICON in tree VSCROLLER */
#define SETTINGS 15 /* form/dial */
-#define SETTINGS_EDIT_HOMEPAGE_00 2 /* FTEXT in tree SETTINGS */
-#define SETTINGS_LBL_CB_HIDE_ADVERTISEMENT 3 /* STRING in tree SETTINGS */
-#define SETTINGS_LBL_CB_DISABLE_POPUP_WINDOWS 4 /* STRING in tree SETTINGS */
-#define SETTINGS_CB_HIDE_ADVERTISEMENT 5 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_CB_DISABLE_POPUP_WINDOWS 6 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_LBL_CB_SEND_HTTP_REFERRER 7 /* STRING in tree SETTINGS */
-#define SETTINGS_CB_SEND_HTTP_REFERRER 8 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_LBL_CB_SEND_DO_NOT_TRACK 9 /* STRING in tree SETTINGS */
-#define SETTINGS_CB_SEND_DO_NOT_TRACK 10 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_DEC_HISTORY_AGE 12 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_EDIT_HISTORY_AGE 13 /* FTEXT in tree SETTINGS */
-#define SETTINGS_INC_HISTORY_AGE 14 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_SAVE 1 /* BUTTON in tree SETTINGS */
+#define SETTINGS_ABORT 2 /* BUTTON in tree SETTINGS */
+#define SETTINGS_GROUP_BROWSER 3 /* IBOX in tree SETTINGS */
+#define SETTINGS_EDIT_HOMEPAGE 5 /* FTEXT in tree SETTINGS */
+#define SETTINGS_LBL_CB_HIDE_ADVERTISEMENT 6 /* STRING in tree SETTINGS */
+#define SETTINGS_LBL_CB_DISABLE_POPUP_WINDOWS 7 /* STRING in tree SETTINGS */
+#define SETTINGS_CB_HIDE_ADVERTISEMENT 8 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_DISABLE_POPUP_WINDOWS 9 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_LBL_CB_SEND_HTTP_REFERRER 10 /* STRING in tree SETTINGS */
+#define SETTINGS_CB_SEND_HTTP_REFERRER 11 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_LBL_CB_SEND_DO_NOT_TRACK 12 /* STRING in tree SETTINGS */
+#define SETTINGS_CB_SEND_DO_NOT_TRACK 13 /* BOXCHAR in tree SETTINGS */
#define SETTINGS_BT_CLEAR_HISTORY 15 /* BUTTON in tree SETTINGS */
#define SETTINGS_BT_SEL_LOCALE 17 /* BUTTON in tree SETTINGS */
#define SETTINGS_BT_GUI_LANG 19 /* BUTTON in tree SETTINGS */
+#define SETTINGS_INC_MEM_CACHE 22 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_MEM_CACHE 23 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_STR_MAX_MEM_CACHE 24 /* STRING in tree SETTINGS */
+#define SETTINGS_DEC_HISTORY_AGE 27 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_HISTORY_AGE 28 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_HISTORY_AGE 29 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_GROUP_NETWORK 32 /* IBOX in tree SETTINGS */
+#define SETTINGS_CB_USE_PROXY 34 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_LBL_USE_PROXY 35 /* STRING in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_HOST 36 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_PORT 38 /* FTEXT in tree SETTINGS */
+#define SETTINGS_CB_PROXY_AUTH 39 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_USERNAME 41 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_PASSWORD 42 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_MAX_FETCHERS 47 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_MAX_FETCHERS 48 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_MAX_FETCHERS 49 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_MAX_FETCHERS_PER_HOST 51 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MAX_FETCHERS_PER_HOST 52 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_MAX_FETCHERS_PER_HOST 53 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_CACHED_CONNECTIONS 55 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MAX_CACHED_CONNECTIONS 56 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_CACHED_CONNECTIONS 57 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_GROUP_RENDERING 59 /* IBOX in tree SETTINGS */
+/* Make sure that initial value is large enough! */
+#define SETTINGS_BT_SEL_FONT_RENDERER 62 /* BUTTON in tree SETTINGS */
+#define SETTINGS_CB_ANTI_ALIASING 63 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_TRANSPARENCY 65 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_DEF_FONT_SIZE 77 /* FTEXT in tree SETTINGS */
+#define SETTINGS_DEC_DEF_FONT_SIZE 78 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_INC_DEF_FONT_SIZE 79 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MIN_FONT_SIZE 81 /* FTEXT in tree SETTINGS */
+#define SETTINGS_DEC_MIN_FONT_SIZE 82 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_INC_MIN_FONT_SIZE 83 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MIN_GIF_DELAY 72 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_GIF_DELAY 73 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_GIF_DELAY 74 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_ENABLE_ANIMATION 67 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_BG_IMAGES 102 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_FG_IMAGES 105 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_GROUP_RENDERING_00 86 /* IBOX in tree SETTINGS */
+#define SETTINGS_EDIT_DOWNLOAD_PATH 90 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_HOTLIST_FILE 91 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_CA_BUNDLE 92 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_CA_CERTS_PATH 93 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_EDITOR 94 /* FTEXT in tree SETTINGS */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index 6f9ae05..b302e72 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -2,8 +2,8 @@ ResourceMaster v3.65
#C 16@0@0@0@
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
-#R 0@0@1@1@1@1@
-#M 20010100@0@7728@625@
+#R 0@0@2@1@2@1@
+#M 20010100@0@7728@628@
#T 0@1@MAINMENU@@62@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -120,7 +120,7 @@ ResourceMaster v3.65
#O 9@21@SAVE_AS@@
#O 10@21@VIEW_SOURCE@@
#O 11@21@SAVE_LINK_AS@@
-#T 13@2@CHOICES@@110@@
+#T 13@2@CHOICES@@74@@
#O 1@26@REG_BROWSER@@
#O 2@26@REG_RENDER@@
#O 3@26@REG_STYLE@@
@@ -128,68 +128,46 @@ ResourceMaster v3.65
#O 5@26@REG_PATH@@
#O 6@26@REG_CACHE@@
#O 7@26@TAB_STYLE@@
-#O 10@29@EDIT_DEF_FONT_SIZE@@
-#O 11@27@DEC_DEF_FONT_SIZE@@
-#O 12@27@INC_DEF_FONT_SIZE@@
-#O 16@29@EDIT_MIN_FONT_SIZE@@
-#O 17@27@DEC_MIN_FONT_SIZE@@
-#O 18@27@INC_MIN_FONT_SIZE@@
-#O 22@26@BT_TOOLBAR_ICONSET@@
-#O 24@29@INPUT_TOOLBAR_BGCOLOR@@
-#O 25@26@TAB_RENDER@@
-#O 26@26@BT_SEL_FONT_RENDERER@Make sure that initial value is large enough!@
-#O 28@26@CB_TRANSPARENCY@@
-#O 30@26@CB_ENABLE_ANIMATION@@
-#O 33@29@EDIT_MIN_GIF_DELAY@@
-#O 34@27@DEC_GIF_DELAY@@
-#O 35@27@INC_GIF_DELAY@@
-#O 37@26@CB_INCREMENTAL_REFLOW@@
-#O 39@29@EDIT_MIN_REFLOW_PERIOD@@
-#O 40@27@DEC_INCREMENTAL_REFLOW@@
-#O 41@27@INC_INCREMENTAL_REFLOW@@
-#O 43@26@CB_ANTI_ALIASING@@
-#O 44@26@TAB_PATH@@
-#O 49@29@EDIT_CA_CERTS_PATH@@
-#O 50@29@EDIT_DOWNLOAD_PATH@@
-#O 51@29@EDIT_HOTLIST_FILE@@
-#O 52@29@EDIT_CA_BUNDLE@@
-#O 53@29@EDIT_EDITOR@@
-#O 55@26@TAB_CACHE@@
-#O 59@27@INC_MEM_CACHE@@
-#O 60@27@DEC_MEM_CACHE@@
-#O 61@28@STR_MAX_MEM_CACHE@@
-#O 62@26@TAB_BROWSER@@
-#O 64@26@CB_HIDE_ADVERTISEMENT@@
-#O 65@26@CB_DISABLE_POPUP_WINDOWS@@
-#O 66@26@CB_SEND_DO_NOT_TRACK@@
-#O 68@26@BT_SEL_LOCALE@@
-#O 71@26@BT_GUI_LANG@@
-#O 74@29@EDIT_HISTORY_AGE@@
-#O 75@27@DEC_HISTORY_AGE@@
-#O 76@27@INC_HISTORY_AGE@@
-#O 80@26@CB_SEND_HTTP_REFERRER@@
-#O 81@29@EDIT_HOMEPAGE@@
-#O 82@26@BT_CLEAR_HISTORY@@
-#O 83@26@TAB_NETWORK@@
-#O 85@26@CB_USE_PROXY@@
-#O 86@29@EDIT_PROXY_HOST@@
-#O 87@26@CB_PROXY_AUTH@@
-#O 88@29@EDIT_PROXY_USERNAME@@
-#O 89@29@EDIT_PROXY_PASSWORD@@
-#O 91@29@EDIT_PROXY_PORT@@
-#O 96@27@INC_MAX_FETCHERS_PER_HOST@@
-#O 97@27@INC_CACHED_CONNECTIONS@@
-#O 98@27@DEC_MAX_FETCHERS_PER_HOST@@
-#O 99@27@DEC_CACHED_CONNECTIONS@@
-#O 100@29@EDIT_MAX_FETCHERS_PER_HOST@@
-#O 101@29@EDIT_MAX_CACHED_CONNECTIONS@@
-#O 103@29@EDIT_MAX_FETCHERS@@
-#O 104@27@DEC_MAX_FETCHERS@@
-#O 105@27@INC_MAX_FETCHERS@@
-#O 106@26@CB_FG_IMAGES@@
-#O 107@26@CB_BG_IMAGES@@
-#O 108@26@ABORT@@
-#O 109@26@OK@@
+#O 11@26@BT_TOOLBAR_ICONSET@@
+#O 13@29@INPUT_TOOLBAR_BGCOLOR@@
+#O 14@26@TAB_RENDER@@
+#O 15@26@CB_TRANSPARENCY@@
+#O 17@26@CB_ENABLE_ANIMATION@@
+#O 18@26@CB_INCREMENTAL_REFLOW@@
+#O 20@29@EDIT_MIN_REFLOW_PERIOD@@
+#O 21@27@DEC_INCREMENTAL_REFLOW@@
+#O 22@27@INC_INCREMENTAL_REFLOW@@
+#O 24@26@TAB_PATH@@
+#O 25@26@TAB_CACHE@@
+#O 29@27@INC_MEM_CACHE@@
+#O 30@27@DEC_MEM_CACHE@@
+#O 31@28@STR_MAX_MEM_CACHE@@
+#O 32@26@TAB_BROWSER@@
+#O 34@26@CB_HIDE_ADVERTISEMENT@@
+#O 35@26@CB_DISABLE_POPUP_WINDOWS@@
+#O 36@26@CB_SEND_DO_NOT_TRACK@@
+#O 38@26@BT_SEL_LOCALE@@
+#O 41@26@BT_GUI_LANG@@
+#O 44@29@EDIT_HISTORY_AGE@@
+#O 45@27@DEC_HISTORY_AGE@@
+#O 46@27@INC_HISTORY_AGE@@
+#O 50@26@CB_SEND_HTTP_REFERRER@@
+#O 51@29@EDIT_HOMEPAGE@@
+#O 52@26@BT_CLEAR_HISTORY@@
+#O 53@26@TAB_NETWORK@@
+#O 55@26@CB_USE_PROXY@@
+#O 56@29@EDIT_PROXY_HOST@@
+#O 57@26@CB_PROXY_AUTH@@
+#O 58@29@EDIT_PROXY_USERNAME@@
+#O 59@29@EDIT_PROXY_PASSWORD@@
+#O 61@29@EDIT_PROXY_PORT@@
+#O 66@29@EDIT_MAX_FETCHERS@@
+#O 67@27@INC_MAX_FETCHERS@@
+#O 68@27@DEC_MAX_FETCHERS@@
+#O 69@26@CB_FG_IMAGES@@
+#O 70@26@CB_BG_IMAGES@@
+#O 72@26@ABORT@@
+#O 73@26@OK@@
#T 14@2@VSCROLLER@@8@@
#O 1@20@AREA@@
#O 2@26@SLIDER_AREA@@
@@ -198,20 +176,65 @@ ResourceMaster v3.65
#O 5@33@BT_DOWN_PIC@@
#O 6@25@BT_UP@@
#O 4@33@BT_UP_PIC@@
-#T 15@2@SETTINGS@@21@@
-#O 2@29@EDIT_HOMEPAGE_00@@
-#O 3@28@LBL_CB_HIDE_ADVERTISEMENT@@
-#O 4@28@LBL_CB_DISABLE_POPUP_WINDOWS@@
-#O 5@27@CB_HIDE_ADVERTISEMENT@@
-#O 6@27@CB_DISABLE_POPUP_WINDOWS@@
-#O 7@28@LBL_CB_SEND_HTTP_REFERRER@@
-#O 8@27@CB_SEND_HTTP_REFERRER@@
-#O 9@28@LBL_CB_SEND_DO_NOT_TRACK@@
-#O 10@27@CB_SEND_DO_NOT_TRACK@@
-#O 12@27@DEC_HISTORY_AGE@@
-#O 13@29@EDIT_HISTORY_AGE@@
-#O 14@27@INC_HISTORY_AGE@@
+#T 15@2@SETTINGS@@107@@
+#O 1@26@SAVE@@
+#O 2@26@ABORT@@
+#O 3@25@GROUP_BROWSER@@
+#O 5@29@EDIT_HOMEPAGE@@
+#O 6@28@LBL_CB_HIDE_ADVERTISEMENT@@
+#O 7@28@LBL_CB_DISABLE_POPUP_WINDOWS@@
+#O 8@27@CB_HIDE_ADVERTISEMENT@@
+#O 9@27@CB_DISABLE_POPUP_WINDOWS@@
+#O 10@28@LBL_CB_SEND_HTTP_REFERRER@@
+#O 11@27@CB_SEND_HTTP_REFERRER@@
+#O 12@28@LBL_CB_SEND_DO_NOT_TRACK@@
+#O 13@27@CB_SEND_DO_NOT_TRACK@@
#O 15@26@BT_CLEAR_HISTORY@@
#O 17@26@BT_SEL_LOCALE@@
#O 19@26@BT_GUI_LANG@@
-#c 28255@
+#O 22@27@INC_MEM_CACHE@@
+#O 23@27@DEC_MEM_CACHE@@
+#O 24@28@STR_MAX_MEM_CACHE@@
+#O 27@27@DEC_HISTORY_AGE@@
+#O 28@29@EDIT_HISTORY_AGE@@
+#O 29@27@INC_HISTORY_AGE@@
+#O 32@25@GROUP_NETWORK@@
+#O 34@27@CB_USE_PROXY@@
+#O 35@28@LBL_USE_PROXY@@
+#O 36@29@EDIT_PROXY_HOST@@
+#O 38@29@EDIT_PROXY_PORT@@
+#O 39@27@CB_PROXY_AUTH@@
+#O 41@29@EDIT_PROXY_USERNAME@@
+#O 42@29@EDIT_PROXY_PASSWORD@@
+#O 47@29@EDIT_MAX_FETCHERS@@
+#O 48@27@INC_MAX_FETCHERS@@
+#O 49@27@DEC_MAX_FETCHERS@@
+#O 51@27@DEC_MAX_FETCHERS_PER_HOST@@
+#O 52@29@EDIT_MAX_FETCHERS_PER_HOST@@
+#O 53@27@INC_MAX_FETCHERS_PER_HOST@@
+#O 55@27@DEC_CACHED_CONNECTIONS@@
+#O 56@29@EDIT_MAX_CACHED_CONNECTIONS@@
+#O 57@27@INC_CACHED_CONNECTIONS@@
+#O 59@25@GROUP_RENDERING@@
+#O 62@26@BT_SEL_FONT_RENDERER@Make sure that initial value is large enough!@
+#O 63@27@CB_ANTI_ALIASING@@
+#O 65@27@CB_TRANSPARENCY@@
+#O 77@29@EDIT_DEF_FONT_SIZE@@
+#O 78@27@DEC_DEF_FONT_SIZE@@
+#O 79@27@INC_DEF_FONT_SIZE@@
+#O 81@29@EDIT_MIN_FONT_SIZE@@
+#O 82@27@DEC_MIN_FONT_SIZE@@
+#O 83@27@INC_MIN_FONT_SIZE@@
+#O 72@29@EDIT_MIN_GIF_DELAY@@
+#O 73@27@INC_GIF_DELAY@@
+#O 74@27@DEC_GIF_DELAY@@
+#O 67@27@CB_ENABLE_ANIMATION@@
+#O 102@27@CB_BG_IMAGES@@
+#O 105@27@CB_FG_IMAGES@@
+#O 86@25@GROUP_RENDERING_00@@
+#O 90@29@EDIT_DOWNLOAD_PATH@@
+#O 91@29@EDIT_HOTLIST_FILE@@
+#O 92@29@EDIT_CA_BUNDLE@@
+#O 93@29@EDIT_CA_CERTS_PATH@@
+#O 94@29@EDIT_EDITOR@@
+#c 20992@
diff --git a/atari/settings.c b/atari/settings.c
index 785d6f3..afbf8bd 100644
--- a/atari/settings.c
+++ b/atari/settings.c
@@ -8,7 +8,7 @@
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
-#include <windom.h>
+#include <cflib.h>
#include "desktop/options.h"
#include "desktop/plot_style.h"
@@ -20,12 +20,10 @@
#include "atari/bitmap.h"
#include "atari/findfile.h"
#include "atari/gemtk/gemtk.h"
-
+
extern char options[PATH_MAX];
extern GRECT desk_area;
-
-
static float tmp_option_memory_cache_size;
static float tmp_option_minimum_gif_delay;
static unsigned int tmp_option_expire_url;
@@ -38,25 +36,305 @@ static unsigned int tmp_option_max_cached_fetch_handles;
static colour tmp_option_atari_toolbar_bg;
static short h_aes_win = 0;
+static short edit_obj = -1;
+static short any_obj = -1;
static GUIWIN * settings_guiwin = NULL;
static OBJECT * dlgtree;
+#define OBJ_SELECTED(idx) ((bool)((dlgtree[idx].ob_state & OS_SELECTED)!=0))
+
+#define OBJ_CHECK(idx) (dlgtree[idx].ob_state |= (OS_SELECTED | OS_CROSSED));
+
+#define OBJ_UNCHECK(idx) (dlgtree[idx].ob_state &= ~(OS_SELECTED)); \
+ (dlgtree[idx].ob_state &= ~(OS_CROSSED));
+
+#define OBJ_REDRAW(idx) guiwin_send_redraw(settings_guiwin, \
+ obj_screen_rect(dlgtree, idx));
+
+#define DISABLE_OBJ(idx) (dlgtree[idx].ob_state |= OS_DISABLED); \
+ guiwin_send_redraw(settings_guiwin, \
+ obj_screen_rect(dlgtree, idx));
+
+#define ENABLE_OBJ(idx) (dlgtree[idx].ob_state &= ~(OS_DISABLED)) \
+ guiwin_send_redraw(settings_guiwin, \
+ obj_screen_rect(dlgtree, idx));
+
+#define FORMEVENT(idx) form_event(idx, 0, NULL);
+
+#define INPUT_HOMEPAGE_URL_MAX_LEN 44
+#define INPUT_LOCALE_MAX_LEN 6
+#define INPUT_PROXY_HOST_MAX_LEN 31
+#define INPUT_PROXY_USERNAME_MAX_LEN 36
+#define INPUT_PROXY_PASSWORD_MAX_LEN 36
+#define INPUT_PROXY_PORT_MAX_LEN 5
+#define INPUT_MIN_REFLOW_PERIOD_MAX_LEN 4
+#define LABEL_FONT_RENDERER_MAX_LEN 8
+#define LABEL_PATH_MAX_LEN 43
+#define LABEL_ICONSET_MAX_LEN 8
+#define INPUT_TOOLBAR_COLOR_MAX_LEN 6
+
+#define CB_SELECTED (OS_SELECTED | OS_CROSSED)
+
static void on_close(void);
static void on_redraw(GRECT *clip);
+static void form_event(int index, int external, void *unused2);
+
+static bool obj_is_inside(OBJECT * tree, short obj, GRECT *area)
+{
+ GRECT obj_screen;
+ bool ret = false;
+
+ objc_offset(tree, obj, &obj_screen.g_x, &obj_screen.g_y);
+ obj_screen.g_w = dlgtree[obj].ob_width;
+ obj_screen.g_h = dlgtree[obj].ob_height;
+ ret = rc_intersect(area, &obj_screen);
+
+ return(ret);
+}
+
+static GRECT * obj_screen_rect(OBJECT * tree, short obj)
+{
+ static GRECT obj_screen;
+
+ get_objframe(tree, obj, &obj_screen);
+
+ return(&obj_screen);
+}
+
+static void set_text( short idx, char * text, int len )
+{
+ char spare[255];
+
+ if( len > 254 )
+ len = 254;
+ if( text != NULL ){
+ strncpy( spare, text, 254);
+ } else {
+ strcpy(spare, "");
+ }
+
+ set_string( dlgtree, idx, spare);
+}
+
+/**
+ * Toogle all objects which are directly influenced by other GUI elements
+ * ( like checkbox )
+ */
+static void toggle_objects( void )
+{
+ /* enable / disable (refresh) objects depending on radio button values: */
+ FORMEVENT(SETTINGS_CB_USE_PROXY);
+ FORMEVENT(SETTINGS_CB_PROXY_AUTH);
+ FORMEVENT(SETTINGS_BT_SEL_FONT_RENDERER);
+}
+
+
+/* this gets called each time the settings dialog is opened: */
+static void display_settings(void)
+{
+ char spare[255];
+ // read current settings and display them
+
+ /* "Browser" tab: */
+ set_text( SETTINGS_EDIT_HOMEPAGE, nsoption_charp(homepage_url),
+ INPUT_HOMEPAGE_URL_MAX_LEN );
+
+ if( nsoption_bool(block_ads) ){
+ OBJ_CHECK( SETTINGS_CB_HIDE_ADVERTISEMENT );
+ } else {
+ OBJ_UNCHECK( SETTINGS_CB_HIDE_ADVERTISEMENT );
+ }
+ if( nsoption_bool(target_blank) ){
+ OBJ_UNCHECK( SETTINGS_CB_DISABLE_POPUP_WINDOWS );
+ } else {
+ OBJ_CHECK( SETTINGS_CB_DISABLE_POPUP_WINDOWS );
+ }
+ if( nsoption_bool(send_referer) ){
+ OBJ_CHECK( SETTINGS_CB_SEND_HTTP_REFERRER );
+ } else {
+ OBJ_UNCHECK( SETTINGS_CB_SEND_HTTP_REFERRER );
+ }
+ if( nsoption_bool(do_not_track) ){
+ OBJ_CHECK( SETTINGS_CB_SEND_DO_NOT_TRACK );
+ } else {
+ OBJ_UNCHECK( SETTINGS_CB_SEND_DO_NOT_TRACK );
+ }
+
+ set_text( SETTINGS_BT_SEL_LOCALE,
+ nsoption_charp(accept_language) ? nsoption_charp(accept_language) : (char*)"en",
+ INPUT_LOCALE_MAX_LEN );
+
+ tmp_option_expire_url = nsoption_int(expire_url);
+ snprintf( spare, 255, "%02d", nsoption_int(expire_url) );
+ set_text( SETTINGS_EDIT_HISTORY_AGE, spare, 2 );
+
+ /* "Cache" tab: */
+ tmp_option_memory_cache_size = nsoption_int(memory_cache_size) / 100000;
+ snprintf( spare, 255, "%03.1f", tmp_option_memory_cache_size );
+ set_text( SETTINGS_STR_MAX_MEM_CACHE, spare, 5 );
+
+ /* "Paths" tab: */
+ set_text( SETTINGS_EDIT_DOWNLOAD_PATH, nsoption_charp(downloads_path),
+ LABEL_PATH_MAX_LEN );
+ set_text( SETTINGS_EDIT_HOTLIST_FILE, nsoption_charp(hotlist_file),
+ LABEL_PATH_MAX_LEN );
+ set_text( SETTINGS_EDIT_CA_BUNDLE, nsoption_charp(ca_bundle),
+ LABEL_PATH_MAX_LEN );
+ set_text( SETTINGS_EDIT_CA_CERTS_PATH, nsoption_charp(ca_path),
+ LABEL_PATH_MAX_LEN );
+ set_text( SETTINGS_EDIT_EDITOR, nsoption_charp(atari_editor),
+ LABEL_PATH_MAX_LEN );
+
+ /* "Rendering" tab: */
+ set_text( SETTINGS_BT_SEL_FONT_RENDERER, nsoption_charp(atari_font_driver),
+ LABEL_FONT_RENDERER_MAX_LEN );
+ SET_BIT(dlgtree[SETTINGS_CB_TRANSPARENCY].ob_state,
+ CB_SELECTED, nsoption_int(atari_transparency) ? 1 : 0 );
+ SET_BIT(dlgtree[SETTINGS_CB_ENABLE_ANIMATION].ob_state,
+ CB_SELECTED, nsoption_bool(animate_images) ? 1 : 0 );
+ SET_BIT(dlgtree[SETTINGS_CB_FG_IMAGES].ob_state,
+ CB_SELECTED, nsoption_bool(foreground_images) ? 1 : 0 );
+ SET_BIT(dlgtree[SETTINGS_CB_BG_IMAGES].ob_state,
+ CB_SELECTED, nsoption_bool(background_images) ? 1 : 0 );
+
+/*
+ TODO: enable this option?
+ SET_BIT(dlgtree[SETTINGS_CB_INCREMENTAL_REFLOW].ob_state,
+ CB_SELECTED, nsoption_bool(incremental_reflow) ? 1 : 0 );
+*/
+ SET_BIT(dlgtree[SETTINGS_CB_ANTI_ALIASING].ob_state,
+ CB_SELECTED, nsoption_int(atari_font_monochrom) ? 0 : 1 );
+
+/*
+ TODO: activate this option?
+ tmp_option_min_reflow_period = nsoption_int(min_reflow_period);
+ snprintf( spare, 255, "%04d", tmp_option_min_reflow_period );
+ set_text( SETTINGS_EDIT_MIN_REFLOW_PERIOD, spare,
+ INPUT_MIN_REFLOW_PERIOD_MAX_LEN );
+*/
+
+ tmp_option_minimum_gif_delay = (float)nsoption_int(minimum_gif_delay) / (float)100;
+ snprintf( spare, 255, "%01.1f", tmp_option_minimum_gif_delay );
+ set_text( SETTINGS_EDIT_MIN_GIF_DELAY, spare, 3 );
+
+ /* "Network" tab: */
+ set_text( SETTINGS_EDIT_PROXY_HOST, nsoption_charp(http_proxy_host),
+ INPUT_PROXY_HOST_MAX_LEN );
+ snprintf( spare, 255, "%5d", nsoption_int(http_proxy_port) );
+ set_text( SETTINGS_EDIT_PROXY_PORT, spare,
+ INPUT_PROXY_PORT_MAX_LEN );
+
+ set_text( SETTINGS_EDIT_PROXY_USERNAME, nsoption_charp(http_proxy_auth_user),
+ INPUT_PROXY_USERNAME_MAX_LEN );
+ set_text( SETTINGS_EDIT_PROXY_PASSWORD, nsoption_charp(http_proxy_auth_pass),
+ INPUT_PROXY_PASSWORD_MAX_LEN );
+ SET_BIT(dlgtree[SETTINGS_CB_USE_PROXY].ob_state,
+ CB_SELECTED, nsoption_bool(http_proxy) ? 1 : 0 );
+ SET_BIT(dlgtree[SETTINGS_CB_PROXY_AUTH].ob_state,
+ CB_SELECTED, nsoption_int(http_proxy_auth) ? 1 : 0 );
+
+ tmp_option_max_cached_fetch_handles = nsoption_int(max_cached_fetch_handles);
+ snprintf( spare, 255, "%2d", nsoption_int(max_cached_fetch_handles) );
+ set_text( SETTINGS_EDIT_MAX_CACHED_CONNECTIONS, spare , 2 );
+
+ tmp_option_max_fetchers = nsoption_int(max_fetchers);
+ snprintf( spare, 255, "%2d", nsoption_int(max_fetchers) );
+ set_text( SETTINGS_EDIT_MAX_FETCHERS, spare , 2 );
+
+ tmp_option_max_fetchers_per_host = nsoption_int(max_fetchers_per_host);
+ snprintf( spare, 255, "%2d", nsoption_int(max_fetchers_per_host) );
+ set_text( SETTINGS_EDIT_MAX_FETCHERS_PER_HOST, spare , 2 );
+
+
+ /* "Style" tab: */
+ tmp_option_font_min_size = nsoption_int(font_min_size);
+ snprintf( spare, 255, "%3d", nsoption_int(font_min_size) );
+ set_text( SETTINGS_EDIT_MIN_FONT_SIZE, spare , 3 );
+
+ tmp_option_font_size = nsoption_int(font_size);
+ snprintf( spare, 255, "%3d", nsoption_int(font_size) );
+ set_text( SETTINGS_EDIT_DEF_FONT_SIZE, spare , 3 );
+}
+
+static void
+form_event(int index, int external, void *unused2)
+{
+ char spare[255];
+ bool is_button = false;
+ bool checked = OBJ_SELECTED( index );
+ char * tmp;
+
+ /* For font driver popup: */
+ const char *font_driver_items[] = {"freetype", "internal" };
+ int num_font_drivers = (sizeof(font_driver_items)/sizeof(char*));
+
+ /*
+ Just a small collection of locales, each country has at least one
+ ATARI-clone user! :)
+ */
+ const char *locales[] = {
+ "cs", "de", "de-de" , "en", "en-gb", "en-us", "es",
+ "fr", "it", "nl", "no", "pl", "ru", "sk", "sv"
+ };
+ int num_locales = (sizeof(locales)/sizeof(char*));
+ short x, y;
+ int choice;
+
+ switch( index ){
+
+
+ case SETTINGS_INC_HISTORY_AGE:
+ case SETTINGS_DEC_HISTORY_AGE:
+ if( index == SETTINGS_INC_HISTORY_AGE )
+ tmp_option_expire_url += 1;
+ else
+ tmp_option_expire_url -= 1;
+
+ if( tmp_option_expire_url > 99 )
+ tmp_option_expire_url = 0;
+
+ snprintf( spare, 255, "%02d", tmp_option_expire_url );
+ set_text( SETTINGS_EDIT_HISTORY_AGE, spare, 2 );
+ OBJ_REDRAW(SETTINGS_EDIT_HISTORY_AGE);
+ is_button = true;
+
+ default: break;
+ }
+ if( is_button ){
+ // remove selection indicator from button element:
+ OBJ_UNCHECK(index);
+ OBJ_REDRAW(index);
+ }
+}
static void on_redraw(GRECT *clip)
{
GRECT visible, work, clip_ro;
int scroll_px_x, scroll_px_y;
struct guiwin_scroll_info_s *slid;
+ int new_x, new_y, old_x, old_y;
+ short edit_idx;
- /*Walk the AES rectangle list and redraw the visible areas of the window: */
+ /* Walk the AES rectangle list and redraw the visible areas of the window: */
guiwin_get_grect(settings_guiwin, GUIWIN_AREA_CONTENT, &work);
slid = guiwin_get_scroll_info(settings_guiwin);
- dlgtree->ob_x = work.g_x - (slid->x_pos * slid->x_unit_px);
- dlgtree->ob_y = work.g_y - (slid->y_pos * slid->y_unit_px);
+ old_x = dlgtree->ob_x;
+ old_y = dlgtree->ob_y;
+ dlgtree->ob_x = new_x = work.g_x - (slid->x_pos * slid->x_unit_px);
+ dlgtree->ob_y = new_y = work.g_y - (slid->y_pos * slid->y_unit_px);
+
+ if ((edit_obj > -1) && (obj_is_inside(dlgtree, edit_obj, &work) == true)) {
+ dlgtree->ob_x = old_x;
+ dlgtree->ob_y = old_y;
+ objc_edit(dlgtree, edit_obj, 0, &edit_idx,
+ EDEND);
+ edit_obj = -1;
+
+ dlgtree->ob_x = new_x;
+ dlgtree->ob_y = new_y;
+ }
wind_get_grect(h_aes_win, WF_FIRSTXYWH, &visible);
while (visible.g_x && visible.g_y) {
@@ -71,6 +349,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
short retval = 0;
GRECT clip, work;
+ static short edit_idx = 0;
if ((ev_out->emo_events & MU_MESAG) != 0) {
// handle message
@@ -107,21 +386,78 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
}
if ((ev_out->emo_events & MU_KEYBD) != 0) {
+ if((edit_obj > -1) && obj_is_inside(dlgtree, edit_obj, &work)){
+
+ short next_edit_obj = edit_obj;
+ short next_char = -1;
+ short r;
+
+ guiwin_get_grect(settings_guiwin, GUIWIN_AREA_CONTENT, &work);
+
+ r = form_keybd(dlgtree, edit_obj, next_edit_obj, ev_out->emo_kreturn,
+ &next_edit_obj, &next_char);
+ if (next_edit_obj != edit_obj) {
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx,
+ EDEND);
+ edit_obj = next_edit_obj;
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx,
+ EDINIT);
+ } else {
+ if(next_char > 13)
+ r = objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx,
+ EDCHAR);
+ }
+
+ }
}
if ((ev_out->emo_events & MU_BUTTON) != 0) {
struct guiwin_scroll_info_s *slid;
+ short nextobj, ret=-1;
guiwin_get_grect(settings_guiwin, GUIWIN_AREA_CONTENT, &work);
+
slid = guiwin_get_scroll_info(settings_guiwin);
dlgtree->ob_x = work.g_x - (slid->x_pos * slid->x_unit_px);
dlgtree->ob_y = work.g_y - (slid->y_pos * slid->y_unit_px);
- short obj = objc_find(dlgtree, 0, 8, ev_out->emo_mouse.p_x,
+ any_obj = objc_find(dlgtree, 0, 8, ev_out->emo_mouse.p_x,
ev_out->emo_mouse.p_y);
- printf("clicked: %d\n", obj);
+
+
+ uint16_t type = (dlgtree[any_obj].ob_type & 0xFF);
+ if (type == G_FTEXT || type == G_FBOXTEXT) {
+ printf("text??\n");
+ ret = form_button(dlgtree, any_obj, ev_out->emo_mclicks, &nextobj);
+ if(edit_obj != -1){
+ if (obj_is_inside(dlgtree, edit_obj, &work)) {
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx, EDEND);
+ }
+ }
+ if (obj_is_inside(dlgtree, any_obj, &work)) {
+ edit_obj = any_obj;
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx, EDINIT);
+ }
+ } else {
+ if ((edit_obj != -1) && obj_is_inside(dlgtree, edit_obj, &work)){
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx, EDEND);
+ }
+ edit_obj = -1;
+ printf("xtype: %d\n", dlgtree[any_obj].ob_type & 0xff00 );
+ if (((dlgtree[any_obj].ob_type & 0xff00) & GW_XTYPE_CHECKBOX) != 0) {
+ if (OBJ_SELECTED(any_obj)) {
+ dlgtree[any_obj].ob_state &= ~(OS_SELECTED|OS_CROSSED);
+ } else {
+ dlgtree[any_obj].ob_state |= (OS_SELECTED|OS_CROSSED);
+ }
+ guiwin_send_redraw(win, obj_screen_rect(dlgtree, any_obj));
+ }
+ form_event(any_obj, 1, NULL);
+ }
+ printf("clicked: %d / %d\n", any_obj, ret);
evnt_timer(150);
+
}
return(retval);
@@ -150,6 +486,10 @@ void open_settings(void)
curr.g_x = (desk_area.g_w / 2) - (curr.g_w / 2);
curr.g_y = (desk_area.g_h / 2) - (curr.g_h / 2);
wind_calc_grect(WC_BORDER, kind, &curr, &curr);
+
+ /* set current config values: */
+ display_settings();
+
wind_open_grect(h_aes_win, &curr);
slid = guiwin_get_scroll_info(settings_guiwin);
@@ -159,11 +499,14 @@ void open_settings(void)
slid->x_units = (dlgtree->ob_width/slid->x_unit_px);
slid->y_units = (dlgtree->ob_height/slid->y_unit_px);
guiwin_update_slider(settings_guiwin, GUIWIN_VH_SLIDER);
+
}
}
void close_settings(void)
{
+
+
printf("settings close\n");
guiwin_remove(settings_guiwin);
settings_guiwin = NULL;
@@ -171,3 +514,4 @@ void close_settings(void)
wind_delete(h_aes_win);
h_aes_win = 0;
}
+
-----------------------------------------------------------------------
Summary of changes:
atari/gemtk/gemtk.h | 5 +
atari/res/netsurf.rsc | Bin 36642 -> 38600 bytes
atari/res/netsurf.rsh | 173 +++++++++++++----------
atari/res/netsurf.rsm | 181 ++++++++++++++-----------
atari/settings.c | 362 +++++++++++++++++++++++++++++++++++++++++++++++--
5 files changed, 558 insertions(+), 163 deletions(-)
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index 9c341ba..f931e62 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -51,6 +51,9 @@ OBJECT *get_tree( int idx );
# define MIN(_a,_b) ((_a<_b) ? _a : _b)
#endif
+#ifndef SET_BIT
+# define SET_BIT(field,bit,val) field = (val)?((field)|(bit)):((field) & ~(bit))
+#endif
/* -------------------------------------------------------------------------- */
/* MultiTOS Drag & Drop */
@@ -91,6 +94,8 @@ short msg_box_show(short type, const char * msg);
#define GW_STATUS_ICONIFIED 0x01
#define GW_STATUS_SHADED 0x02
+#define GW_XTYPE_CHECKBOX (101 << 8)
+
#define GUIWIN_VSLIDER 0x01
#define GUIWIN_HSLIDER 0x02
#define GUIWIN_VH_SLIDER 0x03
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index da3d251..3844f5a 100755
Binary files a/atari/res/netsurf.rsc and b/atari/res/netsurf.rsc differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 5ad6b90..70426ba 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -137,69 +137,46 @@
#define CHOICES_REG_PATH 5 /* BUTTON in tree CHOICES */
#define CHOICES_REG_CACHE 6 /* BUTTON in tree CHOICES */
#define CHOICES_TAB_STYLE 7 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_DEF_FONT_SIZE 10 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_DEF_FONT_SIZE 11 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_DEF_FONT_SIZE 12 /* BOXCHAR in tree CHOICES */
-#define CHOICES_EDIT_MIN_FONT_SIZE 16 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_MIN_FONT_SIZE 17 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_MIN_FONT_SIZE 18 /* BOXCHAR in tree CHOICES */
-#define CHOICES_BT_TOOLBAR_ICONSET 22 /* BUTTON in tree CHOICES */
-#define CHOICES_INPUT_TOOLBAR_BGCOLOR 24 /* FTEXT in tree CHOICES */
-#define CHOICES_TAB_RENDER 25 /* BUTTON in tree CHOICES */
-/* Make sure that initial value is large enough! */
-#define CHOICES_BT_SEL_FONT_RENDERER 26 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_TRANSPARENCY 28 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_ENABLE_ANIMATION 30 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_MIN_GIF_DELAY 33 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_GIF_DELAY 34 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_GIF_DELAY 35 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_INCREMENTAL_REFLOW 37 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_MIN_REFLOW_PERIOD 39 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_INCREMENTAL_REFLOW 40 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_INCREMENTAL_REFLOW 41 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_ANTI_ALIASING 43 /* BUTTON in tree CHOICES */
-#define CHOICES_TAB_PATH 44 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_CA_CERTS_PATH 49 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_DOWNLOAD_PATH 50 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_HOTLIST_FILE 51 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_CA_BUNDLE 52 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_EDITOR 53 /* FTEXT in tree CHOICES */
-#define CHOICES_TAB_CACHE 55 /* BUTTON in tree CHOICES */
-#define CHOICES_INC_MEM_CACHE 59 /* BOXCHAR in tree CHOICES */
-#define CHOICES_DEC_MEM_CACHE 60 /* BOXCHAR in tree CHOICES */
-#define CHOICES_STR_MAX_MEM_CACHE 61 /* STRING in tree CHOICES */
-#define CHOICES_TAB_BROWSER 62 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_HIDE_ADVERTISEMENT 64 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_DISABLE_POPUP_WINDOWS 65 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_SEND_DO_NOT_TRACK 66 /* BUTTON in tree CHOICES */
-#define CHOICES_BT_SEL_LOCALE 68 /* BUTTON in tree CHOICES */
-#define CHOICES_BT_GUI_LANG 71 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_HISTORY_AGE 74 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_HISTORY_AGE 75 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_HISTORY_AGE 76 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_SEND_HTTP_REFERRER 80 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_HOMEPAGE 81 /* FTEXT in tree CHOICES */
-#define CHOICES_BT_CLEAR_HISTORY 82 /* BUTTON in tree CHOICES */
-#define CHOICES_TAB_NETWORK 83 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_USE_PROXY 85 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_PROXY_HOST 86 /* FTEXT in tree CHOICES */
-#define CHOICES_CB_PROXY_AUTH 87 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_PROXY_USERNAME 88 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_PROXY_PASSWORD 89 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_PROXY_PORT 91 /* FTEXT in tree CHOICES */
-#define CHOICES_INC_MAX_FETCHERS_PER_HOST 96 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_CACHED_CONNECTIONS 97 /* BOXCHAR in tree CHOICES */
-#define CHOICES_DEC_MAX_FETCHERS_PER_HOST 98 /* BOXCHAR in tree CHOICES */
-#define CHOICES_DEC_CACHED_CONNECTIONS 99 /* BOXCHAR in tree CHOICES */
-#define CHOICES_EDIT_MAX_FETCHERS_PER_HOST 100 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_MAX_CACHED_CONNECTIONS 101 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_MAX_FETCHERS 103 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_MAX_FETCHERS 104 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_MAX_FETCHERS 105 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_FG_IMAGES 106 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_BG_IMAGES 107 /* BUTTON in tree CHOICES */
-#define CHOICES_ABORT 108 /* BUTTON in tree CHOICES */
-#define CHOICES_OK 109 /* BUTTON in tree CHOICES */
+#define CHOICES_BT_TOOLBAR_ICONSET 11 /* BUTTON in tree CHOICES */
+#define CHOICES_INPUT_TOOLBAR_BGCOLOR 13 /* FTEXT in tree CHOICES */
+#define CHOICES_TAB_RENDER 14 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_TRANSPARENCY 15 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_ENABLE_ANIMATION 17 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_INCREMENTAL_REFLOW 18 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_MIN_REFLOW_PERIOD 20 /* FTEXT in tree CHOICES */
+#define CHOICES_DEC_INCREMENTAL_REFLOW 21 /* BOXCHAR in tree CHOICES */
+#define CHOICES_INC_INCREMENTAL_REFLOW 22 /* BOXCHAR in tree CHOICES */
+#define CHOICES_TAB_PATH 24 /* BUTTON in tree CHOICES */
+#define CHOICES_TAB_CACHE 25 /* BUTTON in tree CHOICES */
+#define CHOICES_INC_MEM_CACHE 29 /* BOXCHAR in tree CHOICES */
+#define CHOICES_DEC_MEM_CACHE 30 /* BOXCHAR in tree CHOICES */
+#define CHOICES_STR_MAX_MEM_CACHE 31 /* STRING in tree CHOICES */
+#define CHOICES_TAB_BROWSER 32 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_HIDE_ADVERTISEMENT 34 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_DISABLE_POPUP_WINDOWS 35 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_SEND_DO_NOT_TRACK 36 /* BUTTON in tree CHOICES */
+#define CHOICES_BT_SEL_LOCALE 38 /* BUTTON in tree CHOICES */
+#define CHOICES_BT_GUI_LANG 41 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_HISTORY_AGE 44 /* FTEXT in tree CHOICES */
+#define CHOICES_DEC_HISTORY_AGE 45 /* BOXCHAR in tree CHOICES */
+#define CHOICES_INC_HISTORY_AGE 46 /* BOXCHAR in tree CHOICES */
+#define CHOICES_CB_SEND_HTTP_REFERRER 50 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_HOMEPAGE 51 /* FTEXT in tree CHOICES */
+#define CHOICES_BT_CLEAR_HISTORY 52 /* BUTTON in tree CHOICES */
+#define CHOICES_TAB_NETWORK 53 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_USE_PROXY 55 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_PROXY_HOST 56 /* FTEXT in tree CHOICES */
+#define CHOICES_CB_PROXY_AUTH 57 /* BUTTON in tree CHOICES */
+#define CHOICES_EDIT_PROXY_USERNAME 58 /* FTEXT in tree CHOICES */
+#define CHOICES_EDIT_PROXY_PASSWORD 59 /* FTEXT in tree CHOICES */
+#define CHOICES_EDIT_PROXY_PORT 61 /* FTEXT in tree CHOICES */
+#define CHOICES_EDIT_MAX_FETCHERS 66 /* FTEXT in tree CHOICES */
+#define CHOICES_INC_MAX_FETCHERS 67 /* BOXCHAR in tree CHOICES */
+#define CHOICES_DEC_MAX_FETCHERS 68 /* BOXCHAR in tree CHOICES */
+#define CHOICES_CB_FG_IMAGES 69 /* BUTTON in tree CHOICES */
+#define CHOICES_CB_BG_IMAGES 70 /* BUTTON in tree CHOICES */
+#define CHOICES_ABORT 72 /* BUTTON in tree CHOICES */
+#define CHOICES_OK 73 /* BUTTON in tree CHOICES */
#define VSCROLLER 14 /* form/dial */
#define VSCROLLER_AREA 1 /* BOX in tree VSCROLLER */
@@ -211,18 +188,64 @@
#define VSCROLLER_BT_UP_PIC 4 /* CICON in tree VSCROLLER */
#define SETTINGS 15 /* form/dial */
-#define SETTINGS_EDIT_HOMEPAGE_00 2 /* FTEXT in tree SETTINGS */
-#define SETTINGS_LBL_CB_HIDE_ADVERTISEMENT 3 /* STRING in tree SETTINGS */
-#define SETTINGS_LBL_CB_DISABLE_POPUP_WINDOWS 4 /* STRING in tree SETTINGS */
-#define SETTINGS_CB_HIDE_ADVERTISEMENT 5 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_CB_DISABLE_POPUP_WINDOWS 6 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_LBL_CB_SEND_HTTP_REFERRER 7 /* STRING in tree SETTINGS */
-#define SETTINGS_CB_SEND_HTTP_REFERRER 8 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_LBL_CB_SEND_DO_NOT_TRACK 9 /* STRING in tree SETTINGS */
-#define SETTINGS_CB_SEND_DO_NOT_TRACK 10 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_DEC_HISTORY_AGE 12 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_EDIT_HISTORY_AGE 13 /* FTEXT in tree SETTINGS */
-#define SETTINGS_INC_HISTORY_AGE 14 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_SAVE 1 /* BUTTON in tree SETTINGS */
+#define SETTINGS_ABORT 2 /* BUTTON in tree SETTINGS */
+#define SETTINGS_GROUP_BROWSER 3 /* IBOX in tree SETTINGS */
+#define SETTINGS_EDIT_HOMEPAGE 5 /* FTEXT in tree SETTINGS */
+#define SETTINGS_LBL_CB_HIDE_ADVERTISEMENT 6 /* STRING in tree SETTINGS */
+#define SETTINGS_LBL_CB_DISABLE_POPUP_WINDOWS 7 /* STRING in tree SETTINGS */
+#define SETTINGS_CB_HIDE_ADVERTISEMENT 8 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_DISABLE_POPUP_WINDOWS 9 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_LBL_CB_SEND_HTTP_REFERRER 10 /* STRING in tree SETTINGS */
+#define SETTINGS_CB_SEND_HTTP_REFERRER 11 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_LBL_CB_SEND_DO_NOT_TRACK 12 /* STRING in tree SETTINGS */
+#define SETTINGS_CB_SEND_DO_NOT_TRACK 13 /* BOXCHAR in tree SETTINGS */
#define SETTINGS_BT_CLEAR_HISTORY 15 /* BUTTON in tree SETTINGS */
#define SETTINGS_BT_SEL_LOCALE 17 /* BUTTON in tree SETTINGS */
#define SETTINGS_BT_GUI_LANG 19 /* BUTTON in tree SETTINGS */
+#define SETTINGS_INC_MEM_CACHE 22 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_MEM_CACHE 23 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_STR_MAX_MEM_CACHE 24 /* STRING in tree SETTINGS */
+#define SETTINGS_DEC_HISTORY_AGE 27 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_HISTORY_AGE 28 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_HISTORY_AGE 29 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_GROUP_NETWORK 32 /* IBOX in tree SETTINGS */
+#define SETTINGS_CB_USE_PROXY 34 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_LBL_USE_PROXY 35 /* STRING in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_HOST 36 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_PORT 38 /* FTEXT in tree SETTINGS */
+#define SETTINGS_CB_PROXY_AUTH 39 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_USERNAME 41 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_PASSWORD 42 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_MAX_FETCHERS 47 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_MAX_FETCHERS 48 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_MAX_FETCHERS 49 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_MAX_FETCHERS_PER_HOST 51 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MAX_FETCHERS_PER_HOST 52 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_MAX_FETCHERS_PER_HOST 53 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_CACHED_CONNECTIONS 55 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MAX_CACHED_CONNECTIONS 56 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_CACHED_CONNECTIONS 57 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_GROUP_RENDERING 59 /* IBOX in tree SETTINGS */
+/* Make sure that initial value is large enough! */
+#define SETTINGS_BT_SEL_FONT_RENDERER 62 /* BUTTON in tree SETTINGS */
+#define SETTINGS_CB_ANTI_ALIASING 63 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_TRANSPARENCY 65 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_DEF_FONT_SIZE 77 /* FTEXT in tree SETTINGS */
+#define SETTINGS_DEC_DEF_FONT_SIZE 78 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_INC_DEF_FONT_SIZE 79 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MIN_FONT_SIZE 81 /* FTEXT in tree SETTINGS */
+#define SETTINGS_DEC_MIN_FONT_SIZE 82 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_INC_MIN_FONT_SIZE 83 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MIN_GIF_DELAY 72 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_GIF_DELAY 73 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_GIF_DELAY 74 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_ENABLE_ANIMATION 67 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_BG_IMAGES 102 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_FG_IMAGES 105 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_GROUP_RENDERING_00 86 /* IBOX in tree SETTINGS */
+#define SETTINGS_EDIT_DOWNLOAD_PATH 90 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_HOTLIST_FILE 91 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_CA_BUNDLE 92 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_CA_CERTS_PATH 93 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_EDITOR 94 /* FTEXT in tree SETTINGS */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index 6f9ae05..b302e72 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -2,8 +2,8 @@ ResourceMaster v3.65
#C 16@0@0@0@
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
-#R 0@0@1@1@1@1@
-#M 20010100@0@7728@625@
+#R 0@0@2@1@2@1@
+#M 20010100@0@7728@628@
#T 0@1@MAINMENU@@62@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -120,7 +120,7 @@ ResourceMaster v3.65
#O 9@21@SAVE_AS@@
#O 10@21@VIEW_SOURCE@@
#O 11@21@SAVE_LINK_AS@@
-#T 13@2@CHOICES@@110@@
+#T 13@2@CHOICES@@74@@
#O 1@26@REG_BROWSER@@
#O 2@26@REG_RENDER@@
#O 3@26@REG_STYLE@@
@@ -128,68 +128,46 @@ ResourceMaster v3.65
#O 5@26@REG_PATH@@
#O 6@26@REG_CACHE@@
#O 7@26@TAB_STYLE@@
-#O 10@29@EDIT_DEF_FONT_SIZE@@
-#O 11@27@DEC_DEF_FONT_SIZE@@
-#O 12@27@INC_DEF_FONT_SIZE@@
-#O 16@29@EDIT_MIN_FONT_SIZE@@
-#O 17@27@DEC_MIN_FONT_SIZE@@
-#O 18@27@INC_MIN_FONT_SIZE@@
-#O 22@26@BT_TOOLBAR_ICONSET@@
-#O 24@29@INPUT_TOOLBAR_BGCOLOR@@
-#O 25@26@TAB_RENDER@@
-#O 26@26@BT_SEL_FONT_RENDERER@Make sure that initial value is large enough!@
-#O 28@26@CB_TRANSPARENCY@@
-#O 30@26@CB_ENABLE_ANIMATION@@
-#O 33@29@EDIT_MIN_GIF_DELAY@@
-#O 34@27@DEC_GIF_DELAY@@
-#O 35@27@INC_GIF_DELAY@@
-#O 37@26@CB_INCREMENTAL_REFLOW@@
-#O 39@29@EDIT_MIN_REFLOW_PERIOD@@
-#O 40@27@DEC_INCREMENTAL_REFLOW@@
-#O 41@27@INC_INCREMENTAL_REFLOW@@
-#O 43@26@CB_ANTI_ALIASING@@
-#O 44@26@TAB_PATH@@
-#O 49@29@EDIT_CA_CERTS_PATH@@
-#O 50@29@EDIT_DOWNLOAD_PATH@@
-#O 51@29@EDIT_HOTLIST_FILE@@
-#O 52@29@EDIT_CA_BUNDLE@@
-#O 53@29@EDIT_EDITOR@@
-#O 55@26@TAB_CACHE@@
-#O 59@27@INC_MEM_CACHE@@
-#O 60@27@DEC_MEM_CACHE@@
-#O 61@28@STR_MAX_MEM_CACHE@@
-#O 62@26@TAB_BROWSER@@
-#O 64@26@CB_HIDE_ADVERTISEMENT@@
-#O 65@26@CB_DISABLE_POPUP_WINDOWS@@
-#O 66@26@CB_SEND_DO_NOT_TRACK@@
-#O 68@26@BT_SEL_LOCALE@@
-#O 71@26@BT_GUI_LANG@@
-#O 74@29@EDIT_HISTORY_AGE@@
-#O 75@27@DEC_HISTORY_AGE@@
-#O 76@27@INC_HISTORY_AGE@@
-#O 80@26@CB_SEND_HTTP_REFERRER@@
-#O 81@29@EDIT_HOMEPAGE@@
-#O 82@26@BT_CLEAR_HISTORY@@
-#O 83@26@TAB_NETWORK@@
-#O 85@26@CB_USE_PROXY@@
-#O 86@29@EDIT_PROXY_HOST@@
-#O 87@26@CB_PROXY_AUTH@@
-#O 88@29@EDIT_PROXY_USERNAME@@
-#O 89@29@EDIT_PROXY_PASSWORD@@
-#O 91@29@EDIT_PROXY_PORT@@
-#O 96@27@INC_MAX_FETCHERS_PER_HOST@@
-#O 97@27@INC_CACHED_CONNECTIONS@@
-#O 98@27@DEC_MAX_FETCHERS_PER_HOST@@
-#O 99@27@DEC_CACHED_CONNECTIONS@@
-#O 100@29@EDIT_MAX_FETCHERS_PER_HOST@@
-#O 101@29@EDIT_MAX_CACHED_CONNECTIONS@@
-#O 103@29@EDIT_MAX_FETCHERS@@
-#O 104@27@DEC_MAX_FETCHERS@@
-#O 105@27@INC_MAX_FETCHERS@@
-#O 106@26@CB_FG_IMAGES@@
-#O 107@26@CB_BG_IMAGES@@
-#O 108@26@ABORT@@
-#O 109@26@OK@@
+#O 11@26@BT_TOOLBAR_ICONSET@@
+#O 13@29@INPUT_TOOLBAR_BGCOLOR@@
+#O 14@26@TAB_RENDER@@
+#O 15@26@CB_TRANSPARENCY@@
+#O 17@26@CB_ENABLE_ANIMATION@@
+#O 18@26@CB_INCREMENTAL_REFLOW@@
+#O 20@29@EDIT_MIN_REFLOW_PERIOD@@
+#O 21@27@DEC_INCREMENTAL_REFLOW@@
+#O 22@27@INC_INCREMENTAL_REFLOW@@
+#O 24@26@TAB_PATH@@
+#O 25@26@TAB_CACHE@@
+#O 29@27@INC_MEM_CACHE@@
+#O 30@27@DEC_MEM_CACHE@@
+#O 31@28@STR_MAX_MEM_CACHE@@
+#O 32@26@TAB_BROWSER@@
+#O 34@26@CB_HIDE_ADVERTISEMENT@@
+#O 35@26@CB_DISABLE_POPUP_WINDOWS@@
+#O 36@26@CB_SEND_DO_NOT_TRACK@@
+#O 38@26@BT_SEL_LOCALE@@
+#O 41@26@BT_GUI_LANG@@
+#O 44@29@EDIT_HISTORY_AGE@@
+#O 45@27@DEC_HISTORY_AGE@@
+#O 46@27@INC_HISTORY_AGE@@
+#O 50@26@CB_SEND_HTTP_REFERRER@@
+#O 51@29@EDIT_HOMEPAGE@@
+#O 52@26@BT_CLEAR_HISTORY@@
+#O 53@26@TAB_NETWORK@@
+#O 55@26@CB_USE_PROXY@@
+#O 56@29@EDIT_PROXY_HOST@@
+#O 57@26@CB_PROXY_AUTH@@
+#O 58@29@EDIT_PROXY_USERNAME@@
+#O 59@29@EDIT_PROXY_PASSWORD@@
+#O 61@29@EDIT_PROXY_PORT@@
+#O 66@29@EDIT_MAX_FETCHERS@@
+#O 67@27@INC_MAX_FETCHERS@@
+#O 68@27@DEC_MAX_FETCHERS@@
+#O 69@26@CB_FG_IMAGES@@
+#O 70@26@CB_BG_IMAGES@@
+#O 72@26@ABORT@@
+#O 73@26@OK@@
#T 14@2@VSCROLLER@@8@@
#O 1@20@AREA@@
#O 2@26@SLIDER_AREA@@
@@ -198,20 +176,65 @@ ResourceMaster v3.65
#O 5@33@BT_DOWN_PIC@@
#O 6@25@BT_UP@@
#O 4@33@BT_UP_PIC@@
-#T 15@2@SETTINGS@@21@@
-#O 2@29@EDIT_HOMEPAGE_00@@
-#O 3@28@LBL_CB_HIDE_ADVERTISEMENT@@
-#O 4@28@LBL_CB_DISABLE_POPUP_WINDOWS@@
-#O 5@27@CB_HIDE_ADVERTISEMENT@@
-#O 6@27@CB_DISABLE_POPUP_WINDOWS@@
-#O 7@28@LBL_CB_SEND_HTTP_REFERRER@@
-#O 8@27@CB_SEND_HTTP_REFERRER@@
-#O 9@28@LBL_CB_SEND_DO_NOT_TRACK@@
-#O 10@27@CB_SEND_DO_NOT_TRACK@@
-#O 12@27@DEC_HISTORY_AGE@@
-#O 13@29@EDIT_HISTORY_AGE@@
-#O 14@27@INC_HISTORY_AGE@@
+#T 15@2@SETTINGS@@107@@
+#O 1@26@SAVE@@
+#O 2@26@ABORT@@
+#O 3@25@GROUP_BROWSER@@
+#O 5@29@EDIT_HOMEPAGE@@
+#O 6@28@LBL_CB_HIDE_ADVERTISEMENT@@
+#O 7@28@LBL_CB_DISABLE_POPUP_WINDOWS@@
+#O 8@27@CB_HIDE_ADVERTISEMENT@@
+#O 9@27@CB_DISABLE_POPUP_WINDOWS@@
+#O 10@28@LBL_CB_SEND_HTTP_REFERRER@@
+#O 11@27@CB_SEND_HTTP_REFERRER@@
+#O 12@28@LBL_CB_SEND_DO_NOT_TRACK@@
+#O 13@27@CB_SEND_DO_NOT_TRACK@@
#O 15@26@BT_CLEAR_HISTORY@@
#O 17@26@BT_SEL_LOCALE@@
#O 19@26@BT_GUI_LANG@@
-#c 28255@
+#O 22@27@INC_MEM_CACHE@@
+#O 23@27@DEC_MEM_CACHE@@
+#O 24@28@STR_MAX_MEM_CACHE@@
+#O 27@27@DEC_HISTORY_AGE@@
+#O 28@29@EDIT_HISTORY_AGE@@
+#O 29@27@INC_HISTORY_AGE@@
+#O 32@25@GROUP_NETWORK@@
+#O 34@27@CB_USE_PROXY@@
+#O 35@28@LBL_USE_PROXY@@
+#O 36@29@EDIT_PROXY_HOST@@
+#O 38@29@EDIT_PROXY_PORT@@
+#O 39@27@CB_PROXY_AUTH@@
+#O 41@29@EDIT_PROXY_USERNAME@@
+#O 42@29@EDIT_PROXY_PASSWORD@@
+#O 47@29@EDIT_MAX_FETCHERS@@
+#O 48@27@INC_MAX_FETCHERS@@
+#O 49@27@DEC_MAX_FETCHERS@@
+#O 51@27@DEC_MAX_FETCHERS_PER_HOST@@
+#O 52@29@EDIT_MAX_FETCHERS_PER_HOST@@
+#O 53@27@INC_MAX_FETCHERS_PER_HOST@@
+#O 55@27@DEC_CACHED_CONNECTIONS@@
+#O 56@29@EDIT_MAX_CACHED_CONNECTIONS@@
+#O 57@27@INC_CACHED_CONNECTIONS@@
+#O 59@25@GROUP_RENDERING@@
+#O 62@26@BT_SEL_FONT_RENDERER@Make sure that initial value is large enough!@
+#O 63@27@CB_ANTI_ALIASING@@
+#O 65@27@CB_TRANSPARENCY@@
+#O 77@29@EDIT_DEF_FONT_SIZE@@
+#O 78@27@DEC_DEF_FONT_SIZE@@
+#O 79@27@INC_DEF_FONT_SIZE@@
+#O 81@29@EDIT_MIN_FONT_SIZE@@
+#O 82@27@DEC_MIN_FONT_SIZE@@
+#O 83@27@INC_MIN_FONT_SIZE@@
+#O 72@29@EDIT_MIN_GIF_DELAY@@
+#O 73@27@INC_GIF_DELAY@@
+#O 74@27@DEC_GIF_DELAY@@
+#O 67@27@CB_ENABLE_ANIMATION@@
+#O 102@27@CB_BG_IMAGES@@
+#O 105@27@CB_FG_IMAGES@@
+#O 86@25@GROUP_RENDERING_00@@
+#O 90@29@EDIT_DOWNLOAD_PATH@@
+#O 91@29@EDIT_HOTLIST_FILE@@
+#O 92@29@EDIT_CA_BUNDLE@@
+#O 93@29@EDIT_CA_CERTS_PATH@@
+#O 94@29@EDIT_EDITOR@@
+#c 20992@
diff --git a/atari/settings.c b/atari/settings.c
index 785d6f3..afbf8bd 100644
--- a/atari/settings.c
+++ b/atari/settings.c
@@ -8,7 +8,7 @@
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
-#include <windom.h>
+#include <cflib.h>
#include "desktop/options.h"
#include "desktop/plot_style.h"
@@ -20,12 +20,10 @@
#include "atari/bitmap.h"
#include "atari/findfile.h"
#include "atari/gemtk/gemtk.h"
-
+
extern char options[PATH_MAX];
extern GRECT desk_area;
-
-
static float tmp_option_memory_cache_size;
static float tmp_option_minimum_gif_delay;
static unsigned int tmp_option_expire_url;
@@ -38,25 +36,305 @@ static unsigned int tmp_option_max_cached_fetch_handles;
static colour tmp_option_atari_toolbar_bg;
static short h_aes_win = 0;
+static short edit_obj = -1;
+static short any_obj = -1;
static GUIWIN * settings_guiwin = NULL;
static OBJECT * dlgtree;
+#define OBJ_SELECTED(idx) ((bool)((dlgtree[idx].ob_state & OS_SELECTED)!=0))
+
+#define OBJ_CHECK(idx) (dlgtree[idx].ob_state |= (OS_SELECTED | OS_CROSSED));
+
+#define OBJ_UNCHECK(idx) (dlgtree[idx].ob_state &= ~(OS_SELECTED)); \
+ (dlgtree[idx].ob_state &= ~(OS_CROSSED));
+
+#define OBJ_REDRAW(idx) guiwin_send_redraw(settings_guiwin, \
+ obj_screen_rect(dlgtree, idx));
+
+#define DISABLE_OBJ(idx) (dlgtree[idx].ob_state |= OS_DISABLED); \
+ guiwin_send_redraw(settings_guiwin, \
+ obj_screen_rect(dlgtree, idx));
+
+#define ENABLE_OBJ(idx) (dlgtree[idx].ob_state &= ~(OS_DISABLED)) \
+ guiwin_send_redraw(settings_guiwin, \
+ obj_screen_rect(dlgtree, idx));
+
+#define FORMEVENT(idx) form_event(idx, 0, NULL);
+
+#define INPUT_HOMEPAGE_URL_MAX_LEN 44
+#define INPUT_LOCALE_MAX_LEN 6
+#define INPUT_PROXY_HOST_MAX_LEN 31
+#define INPUT_PROXY_USERNAME_MAX_LEN 36
+#define INPUT_PROXY_PASSWORD_MAX_LEN 36
+#define INPUT_PROXY_PORT_MAX_LEN 5
+#define INPUT_MIN_REFLOW_PERIOD_MAX_LEN 4
+#define LABEL_FONT_RENDERER_MAX_LEN 8
+#define LABEL_PATH_MAX_LEN 43
+#define LABEL_ICONSET_MAX_LEN 8
+#define INPUT_TOOLBAR_COLOR_MAX_LEN 6
+
+#define CB_SELECTED (OS_SELECTED | OS_CROSSED)
+
static void on_close(void);
static void on_redraw(GRECT *clip);
+static void form_event(int index, int external, void *unused2);
+
+static bool obj_is_inside(OBJECT * tree, short obj, GRECT *area)
+{
+ GRECT obj_screen;
+ bool ret = false;
+
+ objc_offset(tree, obj, &obj_screen.g_x, &obj_screen.g_y);
+ obj_screen.g_w = dlgtree[obj].ob_width;
+ obj_screen.g_h = dlgtree[obj].ob_height;
+ ret = rc_intersect(area, &obj_screen);
+
+ return(ret);
+}
+
+static GRECT * obj_screen_rect(OBJECT * tree, short obj)
+{
+ static GRECT obj_screen;
+
+ get_objframe(tree, obj, &obj_screen);
+
+ return(&obj_screen);
+}
+
+static void set_text( short idx, char * text, int len )
+{
+ char spare[255];
+
+ if( len > 254 )
+ len = 254;
+ if( text != NULL ){
+ strncpy( spare, text, 254);
+ } else {
+ strcpy(spare, "");
+ }
+
+ set_string( dlgtree, idx, spare);
+}
+
+/**
+ * Toogle all objects which are directly influenced by other GUI elements
+ * ( like checkbox )
+ */
+static void toggle_objects( void )
+{
+ /* enable / disable (refresh) objects depending on radio button values: */
+ FORMEVENT(SETTINGS_CB_USE_PROXY);
+ FORMEVENT(SETTINGS_CB_PROXY_AUTH);
+ FORMEVENT(SETTINGS_BT_SEL_FONT_RENDERER);
+}
+
+
+/* this gets called each time the settings dialog is opened: */
+static void display_settings(void)
+{
+ char spare[255];
+ // read current settings and display them
+
+ /* "Browser" tab: */
+ set_text( SETTINGS_EDIT_HOMEPAGE, nsoption_charp(homepage_url),
+ INPUT_HOMEPAGE_URL_MAX_LEN );
+
+ if( nsoption_bool(block_ads) ){
+ OBJ_CHECK( SETTINGS_CB_HIDE_ADVERTISEMENT );
+ } else {
+ OBJ_UNCHECK( SETTINGS_CB_HIDE_ADVERTISEMENT );
+ }
+ if( nsoption_bool(target_blank) ){
+ OBJ_UNCHECK( SETTINGS_CB_DISABLE_POPUP_WINDOWS );
+ } else {
+ OBJ_CHECK( SETTINGS_CB_DISABLE_POPUP_WINDOWS );
+ }
+ if( nsoption_bool(send_referer) ){
+ OBJ_CHECK( SETTINGS_CB_SEND_HTTP_REFERRER );
+ } else {
+ OBJ_UNCHECK( SETTINGS_CB_SEND_HTTP_REFERRER );
+ }
+ if( nsoption_bool(do_not_track) ){
+ OBJ_CHECK( SETTINGS_CB_SEND_DO_NOT_TRACK );
+ } else {
+ OBJ_UNCHECK( SETTINGS_CB_SEND_DO_NOT_TRACK );
+ }
+
+ set_text( SETTINGS_BT_SEL_LOCALE,
+ nsoption_charp(accept_language) ? nsoption_charp(accept_language) : (char*)"en",
+ INPUT_LOCALE_MAX_LEN );
+
+ tmp_option_expire_url = nsoption_int(expire_url);
+ snprintf( spare, 255, "%02d", nsoption_int(expire_url) );
+ set_text( SETTINGS_EDIT_HISTORY_AGE, spare, 2 );
+
+ /* "Cache" tab: */
+ tmp_option_memory_cache_size = nsoption_int(memory_cache_size) / 100000;
+ snprintf( spare, 255, "%03.1f", tmp_option_memory_cache_size );
+ set_text( SETTINGS_STR_MAX_MEM_CACHE, spare, 5 );
+
+ /* "Paths" tab: */
+ set_text( SETTINGS_EDIT_DOWNLOAD_PATH, nsoption_charp(downloads_path),
+ LABEL_PATH_MAX_LEN );
+ set_text( SETTINGS_EDIT_HOTLIST_FILE, nsoption_charp(hotlist_file),
+ LABEL_PATH_MAX_LEN );
+ set_text( SETTINGS_EDIT_CA_BUNDLE, nsoption_charp(ca_bundle),
+ LABEL_PATH_MAX_LEN );
+ set_text( SETTINGS_EDIT_CA_CERTS_PATH, nsoption_charp(ca_path),
+ LABEL_PATH_MAX_LEN );
+ set_text( SETTINGS_EDIT_EDITOR, nsoption_charp(atari_editor),
+ LABEL_PATH_MAX_LEN );
+
+ /* "Rendering" tab: */
+ set_text( SETTINGS_BT_SEL_FONT_RENDERER, nsoption_charp(atari_font_driver),
+ LABEL_FONT_RENDERER_MAX_LEN );
+ SET_BIT(dlgtree[SETTINGS_CB_TRANSPARENCY].ob_state,
+ CB_SELECTED, nsoption_int(atari_transparency) ? 1 : 0 );
+ SET_BIT(dlgtree[SETTINGS_CB_ENABLE_ANIMATION].ob_state,
+ CB_SELECTED, nsoption_bool(animate_images) ? 1 : 0 );
+ SET_BIT(dlgtree[SETTINGS_CB_FG_IMAGES].ob_state,
+ CB_SELECTED, nsoption_bool(foreground_images) ? 1 : 0 );
+ SET_BIT(dlgtree[SETTINGS_CB_BG_IMAGES].ob_state,
+ CB_SELECTED, nsoption_bool(background_images) ? 1 : 0 );
+
+/*
+ TODO: enable this option?
+ SET_BIT(dlgtree[SETTINGS_CB_INCREMENTAL_REFLOW].ob_state,
+ CB_SELECTED, nsoption_bool(incremental_reflow) ? 1 : 0 );
+*/
+ SET_BIT(dlgtree[SETTINGS_CB_ANTI_ALIASING].ob_state,
+ CB_SELECTED, nsoption_int(atari_font_monochrom) ? 0 : 1 );
+
+/*
+ TODO: activate this option?
+ tmp_option_min_reflow_period = nsoption_int(min_reflow_period);
+ snprintf( spare, 255, "%04d", tmp_option_min_reflow_period );
+ set_text( SETTINGS_EDIT_MIN_REFLOW_PERIOD, spare,
+ INPUT_MIN_REFLOW_PERIOD_MAX_LEN );
+*/
+
+ tmp_option_minimum_gif_delay = (float)nsoption_int(minimum_gif_delay) / (float)100;
+ snprintf( spare, 255, "%01.1f", tmp_option_minimum_gif_delay );
+ set_text( SETTINGS_EDIT_MIN_GIF_DELAY, spare, 3 );
+
+ /* "Network" tab: */
+ set_text( SETTINGS_EDIT_PROXY_HOST, nsoption_charp(http_proxy_host),
+ INPUT_PROXY_HOST_MAX_LEN );
+ snprintf( spare, 255, "%5d", nsoption_int(http_proxy_port) );
+ set_text( SETTINGS_EDIT_PROXY_PORT, spare,
+ INPUT_PROXY_PORT_MAX_LEN );
+
+ set_text( SETTINGS_EDIT_PROXY_USERNAME, nsoption_charp(http_proxy_auth_user),
+ INPUT_PROXY_USERNAME_MAX_LEN );
+ set_text( SETTINGS_EDIT_PROXY_PASSWORD, nsoption_charp(http_proxy_auth_pass),
+ INPUT_PROXY_PASSWORD_MAX_LEN );
+ SET_BIT(dlgtree[SETTINGS_CB_USE_PROXY].ob_state,
+ CB_SELECTED, nsoption_bool(http_proxy) ? 1 : 0 );
+ SET_BIT(dlgtree[SETTINGS_CB_PROXY_AUTH].ob_state,
+ CB_SELECTED, nsoption_int(http_proxy_auth) ? 1 : 0 );
+
+ tmp_option_max_cached_fetch_handles = nsoption_int(max_cached_fetch_handles);
+ snprintf( spare, 255, "%2d", nsoption_int(max_cached_fetch_handles) );
+ set_text( SETTINGS_EDIT_MAX_CACHED_CONNECTIONS, spare , 2 );
+
+ tmp_option_max_fetchers = nsoption_int(max_fetchers);
+ snprintf( spare, 255, "%2d", nsoption_int(max_fetchers) );
+ set_text( SETTINGS_EDIT_MAX_FETCHERS, spare , 2 );
+
+ tmp_option_max_fetchers_per_host = nsoption_int(max_fetchers_per_host);
+ snprintf( spare, 255, "%2d", nsoption_int(max_fetchers_per_host) );
+ set_text( SETTINGS_EDIT_MAX_FETCHERS_PER_HOST, spare , 2 );
+
+
+ /* "Style" tab: */
+ tmp_option_font_min_size = nsoption_int(font_min_size);
+ snprintf( spare, 255, "%3d", nsoption_int(font_min_size) );
+ set_text( SETTINGS_EDIT_MIN_FONT_SIZE, spare , 3 );
+
+ tmp_option_font_size = nsoption_int(font_size);
+ snprintf( spare, 255, "%3d", nsoption_int(font_size) );
+ set_text( SETTINGS_EDIT_DEF_FONT_SIZE, spare , 3 );
+}
+
+static void
+form_event(int index, int external, void *unused2)
+{
+ char spare[255];
+ bool is_button = false;
+ bool checked = OBJ_SELECTED( index );
+ char * tmp;
+
+ /* For font driver popup: */
+ const char *font_driver_items[] = {"freetype", "internal" };
+ int num_font_drivers = (sizeof(font_driver_items)/sizeof(char*));
+
+ /*
+ Just a small collection of locales, each country has at least one
+ ATARI-clone user! :)
+ */
+ const char *locales[] = {
+ "cs", "de", "de-de" , "en", "en-gb", "en-us", "es",
+ "fr", "it", "nl", "no", "pl", "ru", "sk", "sv"
+ };
+ int num_locales = (sizeof(locales)/sizeof(char*));
+ short x, y;
+ int choice;
+
+ switch( index ){
+
+
+ case SETTINGS_INC_HISTORY_AGE:
+ case SETTINGS_DEC_HISTORY_AGE:
+ if( index == SETTINGS_INC_HISTORY_AGE )
+ tmp_option_expire_url += 1;
+ else
+ tmp_option_expire_url -= 1;
+
+ if( tmp_option_expire_url > 99 )
+ tmp_option_expire_url = 0;
+
+ snprintf( spare, 255, "%02d", tmp_option_expire_url );
+ set_text( SETTINGS_EDIT_HISTORY_AGE, spare, 2 );
+ OBJ_REDRAW(SETTINGS_EDIT_HISTORY_AGE);
+ is_button = true;
+
+ default: break;
+ }
+ if( is_button ){
+ // remove selection indicator from button element:
+ OBJ_UNCHECK(index);
+ OBJ_REDRAW(index);
+ }
+}
static void on_redraw(GRECT *clip)
{
GRECT visible, work, clip_ro;
int scroll_px_x, scroll_px_y;
struct guiwin_scroll_info_s *slid;
+ int new_x, new_y, old_x, old_y;
+ short edit_idx;
- /*Walk the AES rectangle list and redraw the visible areas of the window: */
+ /* Walk the AES rectangle list and redraw the visible areas of the window: */
guiwin_get_grect(settings_guiwin, GUIWIN_AREA_CONTENT, &work);
slid = guiwin_get_scroll_info(settings_guiwin);
- dlgtree->ob_x = work.g_x - (slid->x_pos * slid->x_unit_px);
- dlgtree->ob_y = work.g_y - (slid->y_pos * slid->y_unit_px);
+ old_x = dlgtree->ob_x;
+ old_y = dlgtree->ob_y;
+ dlgtree->ob_x = new_x = work.g_x - (slid->x_pos * slid->x_unit_px);
+ dlgtree->ob_y = new_y = work.g_y - (slid->y_pos * slid->y_unit_px);
+
+ if ((edit_obj > -1) && (obj_is_inside(dlgtree, edit_obj, &work) == true)) {
+ dlgtree->ob_x = old_x;
+ dlgtree->ob_y = old_y;
+ objc_edit(dlgtree, edit_obj, 0, &edit_idx,
+ EDEND);
+ edit_obj = -1;
+
+ dlgtree->ob_x = new_x;
+ dlgtree->ob_y = new_y;
+ }
wind_get_grect(h_aes_win, WF_FIRSTXYWH, &visible);
while (visible.g_x && visible.g_y) {
@@ -71,6 +349,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
short retval = 0;
GRECT clip, work;
+ static short edit_idx = 0;
if ((ev_out->emo_events & MU_MESAG) != 0) {
// handle message
@@ -107,21 +386,78 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
}
if ((ev_out->emo_events & MU_KEYBD) != 0) {
+ if((edit_obj > -1) && obj_is_inside(dlgtree, edit_obj, &work)){
+
+ short next_edit_obj = edit_obj;
+ short next_char = -1;
+ short r;
+
+ guiwin_get_grect(settings_guiwin, GUIWIN_AREA_CONTENT, &work);
+
+ r = form_keybd(dlgtree, edit_obj, next_edit_obj, ev_out->emo_kreturn,
+ &next_edit_obj, &next_char);
+ if (next_edit_obj != edit_obj) {
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx,
+ EDEND);
+ edit_obj = next_edit_obj;
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx,
+ EDINIT);
+ } else {
+ if(next_char > 13)
+ r = objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx,
+ EDCHAR);
+ }
+
+ }
}
if ((ev_out->emo_events & MU_BUTTON) != 0) {
struct guiwin_scroll_info_s *slid;
+ short nextobj, ret=-1;
guiwin_get_grect(settings_guiwin, GUIWIN_AREA_CONTENT, &work);
+
slid = guiwin_get_scroll_info(settings_guiwin);
dlgtree->ob_x = work.g_x - (slid->x_pos * slid->x_unit_px);
dlgtree->ob_y = work.g_y - (slid->y_pos * slid->y_unit_px);
- short obj = objc_find(dlgtree, 0, 8, ev_out->emo_mouse.p_x,
+ any_obj = objc_find(dlgtree, 0, 8, ev_out->emo_mouse.p_x,
ev_out->emo_mouse.p_y);
- printf("clicked: %d\n", obj);
+
+
+ uint16_t type = (dlgtree[any_obj].ob_type & 0xFF);
+ if (type == G_FTEXT || type == G_FBOXTEXT) {
+ printf("text??\n");
+ ret = form_button(dlgtree, any_obj, ev_out->emo_mclicks, &nextobj);
+ if(edit_obj != -1){
+ if (obj_is_inside(dlgtree, edit_obj, &work)) {
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx, EDEND);
+ }
+ }
+ if (obj_is_inside(dlgtree, any_obj, &work)) {
+ edit_obj = any_obj;
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx, EDINIT);
+ }
+ } else {
+ if ((edit_obj != -1) && obj_is_inside(dlgtree, edit_obj, &work)){
+ objc_edit(dlgtree, edit_obj, ev_out->emo_kreturn, &edit_idx, EDEND);
+ }
+ edit_obj = -1;
+ printf("xtype: %d\n", dlgtree[any_obj].ob_type & 0xff00 );
+ if (((dlgtree[any_obj].ob_type & 0xff00) & GW_XTYPE_CHECKBOX) != 0) {
+ if (OBJ_SELECTED(any_obj)) {
+ dlgtree[any_obj].ob_state &= ~(OS_SELECTED|OS_CROSSED);
+ } else {
+ dlgtree[any_obj].ob_state |= (OS_SELECTED|OS_CROSSED);
+ }
+ guiwin_send_redraw(win, obj_screen_rect(dlgtree, any_obj));
+ }
+ form_event(any_obj, 1, NULL);
+ }
+ printf("clicked: %d / %d\n", any_obj, ret);
evnt_timer(150);
+
}
return(retval);
@@ -150,6 +486,10 @@ void open_settings(void)
curr.g_x = (desk_area.g_w / 2) - (curr.g_w / 2);
curr.g_y = (desk_area.g_h / 2) - (curr.g_h / 2);
wind_calc_grect(WC_BORDER, kind, &curr, &curr);
+
+ /* set current config values: */
+ display_settings();
+
wind_open_grect(h_aes_win, &curr);
slid = guiwin_get_scroll_info(settings_guiwin);
@@ -159,11 +499,14 @@ void open_settings(void)
slid->x_units = (dlgtree->ob_width/slid->x_unit_px);
slid->y_units = (dlgtree->ob_height/slid->y_unit_px);
guiwin_update_slider(settings_guiwin, GUIWIN_VH_SLIDER);
+
}
}
void close_settings(void)
{
+
+
printf("settings close\n");
guiwin_remove(settings_guiwin);
settings_guiwin = NULL;
@@ -171,3 +514,4 @@ void close_settings(void)
wind_delete(h_aes_win);
h_aes_win = 0;
}
+
--
NetSurf Browser
10 years, 11 months
netsurf: branch mono/interactive-about_config updated. db356ce99f6a8a7ee0b50655654329ed3964b6dc
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/db356ce99f6a8a7ee0b50...
...commit http://git.netsurf-browser.org/netsurf.git/commit/db356ce99f6a8a7ee0b5065...
...tree http://git.netsurf-browser.org/netsurf.git/tree/db356ce99f6a8a7ee0b506556...
The branch, mono/interactive-about_config has been updated
via db356ce99f6a8a7ee0b50655654329ed3964b6dc (commit)
from 9edb37cf6efc265ec7bc0f95ec7dc3656e750c2c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/db356ce99f6a8a7ee0b...
commit db356ce99f6a8a7ee0b50655654329ed3964b6dc
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Set colour style on text input directly (nsoptions_output_html_input)
diff --git a/desktop/options.c b/desktop/options.c
index 12468fb..2c7d40e 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -314,11 +314,10 @@ nsoption_output_value_html_input(struct option_entry_s *option,
((0x0000FF00 & *((colour *) option->p)) << 0) |
((0x00FF0000 & *((colour *) option->p)) >> 16);
slen = snprintf(string + pos, size - pos,
- "<input type=\"text\" name=\"%s\" value=\"%06x\"/> "
- "<span style=\"background-color: #%06x; color: #%06x; \">"
- " </span>",
- option->key, rgbcolour,
- rgbcolour, (~rgbcolour) & 0xffffff);
+ "<input style=\"color: #%06x; background-color: #%06x;\" "
+ "type=\"text\" name=\"%s\" value=\"%06x\"/>",
+ (~rgbcolour) & 0xffffff, rgbcolour,
+ option->key, rgbcolour);
break;
case OPTION_STRING:
-----------------------------------------------------------------------
Summary of changes:
desktop/options.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/desktop/options.c b/desktop/options.c
index 12468fb..2c7d40e 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -314,11 +314,10 @@ nsoption_output_value_html_input(struct option_entry_s *option,
((0x0000FF00 & *((colour *) option->p)) << 0) |
((0x00FF0000 & *((colour *) option->p)) >> 16);
slen = snprintf(string + pos, size - pos,
- "<input type=\"text\" name=\"%s\" value=\"%06x\"/> "
- "<span style=\"background-color: #%06x; color: #%06x; \">"
- " </span>",
- option->key, rgbcolour,
- rgbcolour, (~rgbcolour) & 0xffffff);
+ "<input style=\"color: #%06x; background-color: #%06x;\" "
+ "type=\"text\" name=\"%s\" value=\"%06x\"/>",
+ (~rgbcolour) & 0xffffff, rgbcolour,
+ option->key, rgbcolour);
break;
case OPTION_STRING:
--
NetSurf Browser
10 years, 11 months
netsurf: branch mono/interactive-about_config updated. 9edb37cf6efc265ec7bc0f95ec7dc3656e750c2c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/9edb37cf6efc265ec7bc0...
...commit http://git.netsurf-browser.org/netsurf.git/commit/9edb37cf6efc265ec7bc0f9...
...tree http://git.netsurf-browser.org/netsurf.git/tree/9edb37cf6efc265ec7bc0f95e...
The branch, mono/interactive-about_config has been updated
via 9edb37cf6efc265ec7bc0f95ec7dc3656e750c2c (commit)
from 94d77a95208e4472cb882cbbec72aad6707ad388 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/9edb37cf6efc265ec7b...
commit 9edb37cf6efc265ec7bc0f95ec7dc3656e750c2c
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Added comment
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index d57c67d..25a036d 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -314,7 +314,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
struct fetch_multipart_data *post_item;
bool do_save = false;
- /* save settings: */
+ /* verify referer when save is requested: */
post_item = ctx->post_multipart;
while (post_item != NULL) {
if (strcmp(post_item->name, "action") == 0
@@ -328,6 +328,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
post_item = post_item->next;
}
+ /* save settings: */
if (do_save) {
post_item = ctx->post_multipart;
while (post_item != NULL) {
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index d57c67d..25a036d 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -314,7 +314,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
struct fetch_multipart_data *post_item;
bool do_save = false;
- /* save settings: */
+ /* verify referer when save is requested: */
post_item = ctx->post_multipart;
while (post_item != NULL) {
if (strcmp(post_item->name, "action") == 0
@@ -328,6 +328,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
post_item = post_item->next;
}
+ /* save settings: */
if (do_save) {
post_item = ctx->post_multipart;
while (post_item != NULL) {
--
NetSurf Browser
10 years, 11 months
netsurf: branch mono/interactive-about_config updated. 94d77a95208e4472cb882cbbec72aad6707ad388
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/94d77a95208e4472cb882...
...commit http://git.netsurf-browser.org/netsurf.git/commit/94d77a95208e4472cb882cb...
...tree http://git.netsurf-browser.org/netsurf.git/tree/94d77a95208e4472cb882cbbe...
The branch, mono/interactive-about_config has been updated
via 94d77a95208e4472cb882cbbec72aad6707ad388 (commit)
from c6c6b4cdfe2f9847af9a49485d8c257e284476a7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/94d77a95208e4472cb8...
commit 94d77a95208e4472cb882cbbec72aad6707ad388
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
No need to include openssl headers.
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 4e67d38..d57c67d 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -58,10 +58,6 @@
#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1
-#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
-# include <openssl/rand.h>
-#endif
-
struct fetch_about_context;
typedef bool (*fetch_about_handler)(struct fetch_about_context *);
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 4e67d38..d57c67d 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -58,10 +58,6 @@
#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1
-#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
-# include <openssl/rand.h>
-#endif
-
struct fetch_about_context;
typedef bool (*fetch_about_handler)(struct fetch_about_context *);
--
NetSurf Browser
10 years, 11 months
netsurf: branch mono/interactive-about_config updated. c6c6b4cdfe2f9847af9a49485d8c257e284476a7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/c6c6b4cdfe2f9847af9a4...
...commit http://git.netsurf-browser.org/netsurf.git/commit/c6c6b4cdfe2f9847af9a494...
...tree http://git.netsurf-browser.org/netsurf.git/tree/c6c6b4cdfe2f9847af9a49485...
The branch, mono/interactive-about_config has been updated
via c6c6b4cdfe2f9847af9a49485d8c257e284476a7 (commit)
from 5b6a910e0936d5a78ad826ed57ef203f186abcca (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/c6c6b4cdfe2f9847af9...
commit c6c6b4cdfe2f9847af9a49485d8c257e284476a7
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Abandon token idea but check referer instead.
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 4993414..4e67d38 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -56,6 +56,12 @@
#include "utils/testament.h"
#include "image/image_cache.h"
+#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1
+
+#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
+# include <openssl/rand.h>
+#endif
+
struct fetch_about_context;
typedef bool (*fetch_about_handler)(struct fetch_about_context *);
@@ -112,8 +118,6 @@ static bool fetch_about_send_header(struct fetch_about_context *ctx,
}
-
-
static bool fetch_about_blank_handler(struct fetch_about_context *ctx)
{
fetch_msg msg;
@@ -313,33 +317,22 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
url_func_result status;
struct fetch_multipart_data *post_item;
bool do_save = false;
- bool valid_token = false;
- char token[9] = {"12345678"};
/* save settings: */
post_item = ctx->post_multipart;
while (post_item != NULL) {
-
- if (strcmp(post_item->name, "token") == 0
- && strcmp(post_item->value, token) == 0) {
- valid_token = true;
- if (do_save == true) {
- break;
- }
- }
-
if (strcmp(post_item->name, "action") == 0
&& strcmp(post_item->value, "Set") == 0) {
- do_save = true;
- if (valid_token == true) {
- break;
+ if (strcmp(fetch_get_referer_to_send(ctx->fetchh),
+ "about:config")) {
+ do_save = true;
}
+ break;
}
post_item = post_item->next;
}
- if (do_save && valid_token) {
- int opt = 0;
+ if (do_save) {
post_item = ctx->post_multipart;
while (post_item != NULL) {
nsoption_set_key(post_item->name, post_item->value);
@@ -357,7 +350,6 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
-#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1
slen = snprintf(buffer, sizeof buffer,
"<html>\n<head>\n"
"<title>NetSurf Browser Config</title>\n"
@@ -408,13 +400,11 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
"</table>\n");
slen += snprintf(buffer + slen, sizeof buffer - slen,
"<br/><center>"
- "<input type=\"hidden\" name=\"token\" value=\"%s\" />\n"
"<input type=\"submit\" name=\"action\" value=\"Set\" /> \n"
"<input type=\"submit\" name=\"action\" value=\"Abort\" />\n"
"</center><br/>\n"
"</form>\n"
- "</table>\n</body>\n</html>\n",
- token);
+ "</table>\n</body>\n</html>\n");
#else
slen += snprintf(buffer + slen, sizeof buffer - slen,
"</table>\n</body>\n</html>\n");
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about.c | 34 ++++++++++++----------------------
1 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 4993414..4e67d38 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -56,6 +56,12 @@
#include "utils/testament.h"
#include "image/image_cache.h"
+#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1
+
+#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
+# include <openssl/rand.h>
+#endif
+
struct fetch_about_context;
typedef bool (*fetch_about_handler)(struct fetch_about_context *);
@@ -112,8 +118,6 @@ static bool fetch_about_send_header(struct fetch_about_context *ctx,
}
-
-
static bool fetch_about_blank_handler(struct fetch_about_context *ctx)
{
fetch_msg msg;
@@ -313,33 +317,22 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
url_func_result status;
struct fetch_multipart_data *post_item;
bool do_save = false;
- bool valid_token = false;
- char token[9] = {"12345678"};
/* save settings: */
post_item = ctx->post_multipart;
while (post_item != NULL) {
-
- if (strcmp(post_item->name, "token") == 0
- && strcmp(post_item->value, token) == 0) {
- valid_token = true;
- if (do_save == true) {
- break;
- }
- }
-
if (strcmp(post_item->name, "action") == 0
&& strcmp(post_item->value, "Set") == 0) {
- do_save = true;
- if (valid_token == true) {
- break;
+ if (strcmp(fetch_get_referer_to_send(ctx->fetchh),
+ "about:config")) {
+ do_save = true;
}
+ break;
}
post_item = post_item->next;
}
- if (do_save && valid_token) {
- int opt = 0;
+ if (do_save) {
post_item = ctx->post_multipart;
while (post_item != NULL) {
nsoption_set_key(post_item->name, post_item->value);
@@ -357,7 +350,6 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
-#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1
slen = snprintf(buffer, sizeof buffer,
"<html>\n<head>\n"
"<title>NetSurf Browser Config</title>\n"
@@ -408,13 +400,11 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
"</table>\n");
slen += snprintf(buffer + slen, sizeof buffer - slen,
"<br/><center>"
- "<input type=\"hidden\" name=\"token\" value=\"%s\" />\n"
"<input type=\"submit\" name=\"action\" value=\"Set\" /> \n"
"<input type=\"submit\" name=\"action\" value=\"Abort\" />\n"
"</center><br/>\n"
"</form>\n"
- "</table>\n</body>\n</html>\n",
- token);
+ "</table>\n</body>\n</html>\n");
#else
slen += snprintf(buffer + slen, sizeof buffer - slen,
"</table>\n</body>\n</html>\n");
--
NetSurf Browser
10 years, 11 months
netsurf: branch mono/interactive-about_config updated. 5b6a910e0936d5a78ad826ed57ef203f186abcca
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5b6a910e0936d5a78ad82...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5b6a910e0936d5a78ad826e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5b6a910e0936d5a78ad826ed5...
The branch, mono/interactive-about_config has been updated
via 5b6a910e0936d5a78ad826ed57ef203f186abcca (commit)
from 11399e18b29455a2e93a58f434844cd66974e6e8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/5b6a910e0936d5a78ad...
commit 5b6a910e0936d5a78ad826ed57ef203f186abcca
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Removed unused variable
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index a7e289e..4993414 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -342,7 +342,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
int opt = 0;
post_item = ctx->post_multipart;
while (post_item != NULL) {
- bool s = nsoption_set_key(post_item->name, post_item->value);
+ nsoption_set_key(post_item->name, post_item->value);
post_item = post_item->next;
}
}
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index a7e289e..4993414 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -342,7 +342,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
int opt = 0;
post_item = ctx->post_multipart;
while (post_item != NULL) {
- bool s = nsoption_set_key(post_item->name, post_item->value);
+ nsoption_set_key(post_item->name, post_item->value);
post_item = post_item->next;
}
}
--
NetSurf Browser
10 years, 11 months
netsurf: branch mono/interactive-about_config updated. 11399e18b29455a2e93a58f434844cd66974e6e8
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/11399e18b29455a2e93a5...
...commit http://git.netsurf-browser.org/netsurf.git/commit/11399e18b29455a2e93a58f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/11399e18b29455a2e93a58f43...
The branch, mono/interactive-about_config has been updated
via 11399e18b29455a2e93a58f434844cd66974e6e8 (commit)
via 858b8a5a0ad13be8ca57e76c34e1a1bbe993fb07 (commit)
via 68565113f382cc742dd6cb4f685f68996ed32779 (commit)
via 27873fa9fee23c6cd0f498420c5130aec7379aa0 (commit)
via c0f9ae95b9f5ac169f225d2b52d57d05599b6772 (commit)
via 484fa8b110fb10b19808e73c49b345be638cb1db (commit)
from 15f8a056d5daca0600fbb11485060ac3337ffebe (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/11399e18b29455a2e93...
commit 11399e18b29455a2e93a58f434844cd66974e6e8
Merge: 858b8a5 6856511
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Merge branch 'master' into mono/interactive-about_config
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/858b8a5a0ad13be8ca5...
commit 858b8a5a0ad13be8ca57e76c34e1a1bbe993fb07
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
HTML Choices editing works now, but it still requires
some authentication token to be generated to make it secure.
diff --git a/atari/gui.c b/atari/gui.c
index c2158e0..210f0af 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -795,7 +795,8 @@ void gui_quit(void)
browser_window_destroy(gw->browser->bw);
gw = tmp;
}
-
+
+ nsoption_write(options);
global_history_destroy();
hotlist_destroy();
toolbar_exit();
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index f514b1c..a7e289e 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -329,7 +329,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
}
if (strcmp(post_item->name, "action") == 0
- && strcmp(post_item->value, "Save") == 0) {
+ && strcmp(post_item->value, "Set") == 0) {
do_save = true;
if (valid_token == true) {
break;
@@ -342,9 +342,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
int opt = 0;
post_item = ctx->post_multipart;
while (post_item != NULL) {
- printf("%s -> %s\n", post_item->name, post_item->value);
- //opt = nsoption_get_index(post_item->name);
- //nsoption_get_type(opt);
+ bool s = nsoption_set_key(post_item->name, post_item->value);
post_item = post_item->next;
}
}
@@ -411,7 +409,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
slen += snprintf(buffer + slen, sizeof buffer - slen,
"<br/><center>"
"<input type=\"hidden\" name=\"token\" value=\"%s\" />\n"
- "<input type=\"submit\" name=\"action\" value=\"Save\" />\n"
+ "<input type=\"submit\" name=\"action\" value=\"Set\" /> \n"
"<input type=\"submit\" name=\"action\" value=\"Abort\" />\n"
"</center><br/>\n"
"</form>\n"
diff --git a/desktop/options.c b/desktop/options.c
index 4bdac6d..12468fb 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -327,7 +327,7 @@ nsoption_output_value_html_input(struct option_entry_s *option,
option->key,
(*((char **)option->p) != NULL) ?
*((char **)option->p) :
- "NULL");
+ "");
break;
}
@@ -537,3 +537,20 @@ nsoption_dump(FILE *outf)
} while (res > 0);
}
+/* exported interface documented in options.h */
+bool nsoption_set_key(const char *key, const char *value)
+{
+ bool ret = false;
+ int i;
+
+ for (i = 0; i != option_table_entries; i++) {
+ if (strcasecmp(key, option_table[i].key) != 0)
+ continue;
+
+ strtooption(value, option_table + i);
+ ret = true;
+ break;
+ }
+
+ return(ret);
+}
diff --git a/desktop/options.h b/desktop/options.h
index 53c025c..d5c113b 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -179,6 +179,15 @@ int nsoption_snoptionf(char *string, size_t size, unsigned int option,
void nsoption_commandline(int *pargc, char **argv);
/**
+* Set an option by it's key
+*
+* \param name the option key to search for.
+* \param value the value (as string)
+* \return true on success, false when the option key is not found.
+*/
+bool nsoption_set_key(const char *key, const char *value);
+
+/**
* Set default values for unset front-end specific options
*/
void gui_options_init_defaults(void);
-----------------------------------------------------------------------
Summary of changes:
Makefile | 7 ++-
Makefile.defaults | 2 +-
Makefile.sources.javascript | 13 ++-
amiga/Makefile.target | 2 +-
atari/Makefile.target | 2 +-
atari/gui.c | 3 +-
beos/Makefile.target | 93 ++++++++++----------
cocoa/Makefile.target | 6 +-
content/fetchers/about.c | 8 +-
desktop/options.c | 19 ++++-
desktop/options.h | 9 ++
framebuffer/Makefile.target | 2 +-
gtk/Makefile.target | 2 +-
javascript/jsapi.c | 6 +-
javascript/jsapi/binding.h | 159 -----------------------------------
javascript/jsapi/console.bnd | 4 +-
javascript/jsapi/event.bnd | 5 +-
javascript/jsapi/htmlcollection.bnd | 6 +-
javascript/jsapi/htmldocument.bnd | 10 ++-
javascript/jsapi/htmlelement.bnd | 7 +-
javascript/jsapi/location.bnd | 5 +-
javascript/jsapi/navigator.bnd | 5 +-
javascript/jsapi/node.bnd | 3 +-
javascript/jsapi/nodelist.bnd | 6 +-
javascript/jsapi/text.bnd | 6 +-
javascript/jsapi/window.bnd | 14 +++-
monkey/Makefile.target | 2 +-
riscos/Makefile.target | 8 +-
windows/Makefile.target | 77 +++++++++--------
29 files changed, 195 insertions(+), 296 deletions(-)
delete mode 100644 javascript/jsapi/binding.h
diff --git a/Makefile b/Makefile
index baf8354..7a09e6c 100644
--- a/Makefile
+++ b/Makefile
@@ -426,9 +426,14 @@ $(eval $(call feature_enabled,LIBICONV_PLUG,-DLIBICONV_PLUG,,glibc internal icon
# common libraries without pkg-config support
LDFLAGS += -lz
+# add top level and build directory to include search path
+CFLAGS += -I. -I$(OBJROOT)
+
+# export the user agent format
CFLAGS += -DNETSURF_UA_FORMAT_STRING=\"$(NETSURF_UA_FORMAT_STRING)\"
-CFLAGS += -DNETSURF_HOMEPAGE=\"$(NETSURF_HOMEPAGE)\"
+# set the default homepage to use
+CFLAGS += -DNETSURF_HOMEPAGE=\"$(NETSURF_HOMEPAGE)\"
# ----------------------------------------------------------------------------
# General make rules
diff --git a/Makefile.defaults b/Makefile.defaults
index 812a5a9..7650b38 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -93,7 +93,7 @@ NETSURF_HOMEPAGE := "about:welcome"
NETSURF_USE_LIBICONV_PLUG := YES
# Initial CFLAGS. Optimisation level etc. tend to be target specific.
-CFLAGS :=
+CFLAGS :=
# Default installation/execution prefix
PREFIX ?= /usr/local
diff --git a/Makefile.sources.javascript b/Makefile.sources.javascript
index 76a6ff1..4633e9d 100644
--- a/Makefile.sources.javascript
+++ b/Makefile.sources.javascript
@@ -23,9 +23,10 @@ JSAPI_BINDING_text := javascript/jsapi/text.bnd
JSAPI_BINDING_node := javascript/jsapi/node.bnd
JSAPI_BINDING_event := javascript/jsapi/event.bnd
-# 1: input file
-# 2: output file
-# 3: binding name
+# 1: input binding file
+# 2: source output file
+# 3: header output file
+# 4: binding name
define convert_jsapi_binding
S_JSAPI_BINDING += $(2)
@@ -33,7 +34,9 @@ D_JSAPI_BINDING += $(patsubst %.c,%.d,$(2))
$(2): $(1) $(OBJROOT)/created
$$(VQ)echo " GENBIND: $(1)"
- $(Q)nsgenbind -I javascript/WebIDL -d $(patsubst %.c,%.d,$(2)) -o $(2) $(1)
+ $(Q)nsgenbind -I javascript/WebIDL -d $(patsubst %.c,%.d,$(2)) -h $(3) -o $(2) $(1)
+
+$(3): $(2)
endef
@@ -52,7 +55,7 @@ S_JSAPI :=
S_JAVASCRIPT += content.c jsapi.c $(addprefix jsapi/,$(S_JSAPI))
-$(eval $(foreach V,$(filter JSAPI_BINDING_%,$(.VARIABLES)),$(call convert_jsapi_binding,$($(V)),$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).c,$(patsubst JSAPI_BINDING_%,%,$(V))_jsapi)))
+$(eval $(foreach V,$(filter JSAPI_BINDING_%,$(.VARIABLES)),$(call convert_jsapi_binding,$($(V)),$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).c,$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).h,$(patsubst JSAPI_BINDING_%,%,$(V))_jsapi)))
else
S_JAVASCRIPT += none.c
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index ec43fdd..f2c4299 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -2,7 +2,7 @@
# Amiga target setup
# ----------------------------------------------------------------------------
-CFLAGS += -std=c99 -I . -Dnsamiga
+CFLAGS += -std=c99 -Dnsamiga
ifneq ($(SUBTARGET),os3)
CFLAGS += -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__
diff --git a/atari/Makefile.target b/atari/Makefile.target
index 7f05734..8e87a74 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -58,7 +58,7 @@ endif
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
-CFLAGS += -U__STRICT_ANSI__ -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \
+CFLAGS += -U__STRICT_ANSI__ -std=c99 -Dsmall $(WARNFLAGS) -Dnsatari \
-D_BSD_SOURCE \
-D_XOPEN_SOURCE=600 \
-D_POSIX_C_SOURCE=200112L \
diff --git a/atari/gui.c b/atari/gui.c
index c2158e0..210f0af 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -795,7 +795,8 @@ void gui_quit(void)
browser_window_destroy(gw->browser->bw);
gw = tmp;
}
-
+
+ nsoption_write(options);
global_history_destroy();
hotlist_destroy();
toolbar_exit();
diff --git a/beos/Makefile.target b/beos/Makefile.target
index 4edde01..7b473dd 100644
--- a/beos/Makefile.target
+++ b/beos/Makefile.target
@@ -3,35 +3,34 @@
# ----------------------------------------------------------------------------
- $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
-
- LDFLAGS += -L/boot/home/config/lib
- # for Haiku
- LDFLAGS += -L/boot/common/lib
- # some people do *not* have libm...
- LDFLAGS += -lssl -lcrypto -lcss
- $(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
- LDFLAGS += -ldom -lparserutils -lhubbub -lwapcaplet
- LDFLAGS += -lexpat -lcurl -liconv
-
- CFLAGS += -I. -O $(WARNFLAGS) -Dnsbeos \
- -D_BSD_SOURCE -D_POSIX_C_SOURCE \
- -Drestrict="" -Wno-multichar
- # DEBUG
- CFLAGS += -g -O0
- # -DDEBUG=1
-
- BEOS_BERES := beres
- BEOS_RC := rc
- BEOS_XRES := xres
- BEOS_SETVER := setversion
- BEOS_MIMESET := mimeset
- VERSION_FULL := $(shell sed -n '/"/{s/.*"\(.*\)".*/\1/;p;}' desktop/version.c)
- VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
- VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
- RSRC_BEOS = $(addprefix $(OBJROOT)/,$(subst /,_,$(patsubst %.rdef,%.rsrc,$(RDEF_BEOS))))
- RESOURCES = $(RSRC_BEOS)
- ifeq ($(HOST),beos)
+$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
+
+LDFLAGS += -L/boot/home/config/lib
+# for Haiku
+LDFLAGS += -L/boot/common/lib
+# some people do *not* have libm...
+LDFLAGS += -lssl -lcrypto -lcss
+$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
+LDFLAGS += -ldom -lparserutils -lhubbub -lwapcaplet
+LDFLAGS += -lexpat -lcurl -liconv
+
+CFLAGS += -O $(WARNFLAGS) -Dnsbeos -D_BSD_SOURCE -D_POSIX_C_SOURCE \
+ -Drestrict="" -Wno-multichar
+# DEBUG
+CFLAGS += -g -O0
+# -DDEBUG=1
+
+BEOS_BERES := beres
+BEOS_RC := rc
+BEOS_XRES := xres
+BEOS_SETVER := setversion
+BEOS_MIMESET := mimeset
+VERSION_FULL := $(shell sed -n '/"/{s/.*"\(.*\)".*/\1/;p;}' desktop/version.c)
+VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
+VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
+RSRC_BEOS = $(addprefix $(OBJROOT)/,$(subst /,_,$(patsubst %.rdef,%.rsrc,$(RDEF_BEOS))))
+RESOURCES = $(RSRC_BEOS)
+ifeq ($(HOST),beos)
CFLAGS += -I/boot/home/config/include \
-I/boot/home/config/include/libmng \
-I/boot/home/config/include/hubbub \
@@ -66,22 +65,22 @@
LDFLAGS += -lstdc++.r4
else
LDFLAGS += -lstdc++ -lsupc++
- endif
+endif
- ifeq ($(HOST),beos)
- CFLAGS += -I$(PREFIX)/include
- LDFLAGS += -L$(PREFIX)/lib
- $(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,BMP (libnsbmp)))
- $(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif)))
- $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
- else
- NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
- NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
- NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
- $(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
- $(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
- $(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG ))
- endif
+ifeq ($(HOST),beos)
+ CFLAGS += -I$(PREFIX)/include
+ LDFLAGS += -L$(PREFIX)/lib
+ $(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,BMP (libnsbmp)))
+ $(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif)))
+ $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
+else
+ NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
+ NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
+ NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
+ $(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
+ $(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
+ $(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG ))
+endif
# ----------------------------------------------------------------------------
# Source file setup
@@ -89,9 +88,9 @@
# S_BEOS are sources purely for the BeOS build
S_BEOS := about.cpp bitmap.cpp download.cpp fetch_rsrc.cpp filetype.cpp \
- font.cpp gui.cpp login.cpp gui_options.cpp plotters.cpp scaffolding.cpp \
- search.cpp schedule.cpp thumbnail.cpp treeview.cpp throbber.cpp \
- window.cpp system_colour.cpp
+ font.cpp gui.cpp login.cpp gui_options.cpp plotters.cpp \
+ scaffolding.cpp search.cpp schedule.cpp thumbnail.cpp treeview.cpp \
+ throbber.cpp window.cpp system_colour.cpp
S_BEOS := $(addprefix beos/,$(S_BEOS))
RDEF_BEOS := res.rdef
diff --git a/cocoa/Makefile.target b/cocoa/Makefile.target
index d975a0c..2da4c5b 100644
--- a/cocoa/Makefile.target
+++ b/cocoa/Makefile.target
@@ -10,11 +10,9 @@
LDFLAGS += -lm -lcurl -liconv
LDFLAGS += -lssl -lcrypto
- CFLAGS += -I. -O $(WARNFLAGS) -Dnscocoa \
+ CFLAGS += -O $(WARNFLAGS) -Dnscocoa \
-D_BSD_SOURCE -D_POSIX_C_SOURCE \
- -std=c99
-
- CFLAGS += -g -Os -Wno-uninitialized
+ -std=c99 -g -Os
CFLAGS += $(shell $(PKG_CONFIG) --cflags libhubbub libcss libdom)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index f514b1c..a7e289e 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -329,7 +329,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
}
if (strcmp(post_item->name, "action") == 0
- && strcmp(post_item->value, "Save") == 0) {
+ && strcmp(post_item->value, "Set") == 0) {
do_save = true;
if (valid_token == true) {
break;
@@ -342,9 +342,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
int opt = 0;
post_item = ctx->post_multipart;
while (post_item != NULL) {
- printf("%s -> %s\n", post_item->name, post_item->value);
- //opt = nsoption_get_index(post_item->name);
- //nsoption_get_type(opt);
+ bool s = nsoption_set_key(post_item->name, post_item->value);
post_item = post_item->next;
}
}
@@ -411,7 +409,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
slen += snprintf(buffer + slen, sizeof buffer - slen,
"<br/><center>"
"<input type=\"hidden\" name=\"token\" value=\"%s\" />\n"
- "<input type=\"submit\" name=\"action\" value=\"Save\" />\n"
+ "<input type=\"submit\" name=\"action\" value=\"Set\" /> \n"
"<input type=\"submit\" name=\"action\" value=\"Abort\" />\n"
"</center><br/>\n"
"</form>\n"
diff --git a/desktop/options.c b/desktop/options.c
index 4bdac6d..12468fb 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -327,7 +327,7 @@ nsoption_output_value_html_input(struct option_entry_s *option,
option->key,
(*((char **)option->p) != NULL) ?
*((char **)option->p) :
- "NULL");
+ "");
break;
}
@@ -537,3 +537,20 @@ nsoption_dump(FILE *outf)
} while (res > 0);
}
+/* exported interface documented in options.h */
+bool nsoption_set_key(const char *key, const char *value)
+{
+ bool ret = false;
+ int i;
+
+ for (i = 0; i != option_table_entries; i++) {
+ if (strcasecmp(key, option_table[i].key) != 0)
+ continue;
+
+ strtooption(value, option_table + i);
+ ret = true;
+ break;
+ }
+
+ return(ret);
+}
diff --git a/desktop/options.h b/desktop/options.h
index 53c025c..d5c113b 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -179,6 +179,15 @@ int nsoption_snoptionf(char *string, size_t size, unsigned int option,
void nsoption_commandline(int *pargc, char **argv);
/**
+* Set an option by it's key
+*
+* \param name the option key to search for.
+* \param value the value (as string)
+* \return true on success, false when the option key is not found.
+*/
+bool nsoption_set_key(const char *key, const char *value);
+
+/**
* Set default values for unset front-end specific options
*/
void gui_options_init_defaults(void);
diff --git a/framebuffer/Makefile.target b/framebuffer/Makefile.target
index f3d91de..8ab8804 100644
--- a/framebuffer/Makefile.target
+++ b/framebuffer/Makefile.target
@@ -44,7 +44,7 @@ $(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript))
-CFLAGS += -std=c99 -g -I. -Dsmall $(WARNFLAGS) \
+CFLAGS += -std=c99 -g -Dsmall $(WARNFLAGS) \
-D_BSD_SOURCE \
-D_XOPEN_SOURCE=600 \
-D_POSIX_C_SOURCE=200112L \
diff --git a/gtk/Makefile.target b/gtk/Makefile.target
index f9b5436..2d1eebf 100644
--- a/gtk/Makefile.target
+++ b/gtk/Makefile.target
@@ -51,7 +51,7 @@ GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk \
-D_POSIX_C_SOURCE=200112L \
-D_NETBSD_SOURCE \
-DGTK_RESPATH=\"$(NETSURF_GTK_RESOURCES)\" \
- $(WARNFLAGS) -I. -g
+ $(WARNFLAGS) -g
# non optional pkg-configed libs
$(eval $(call pkg_config_find_and_add,libcss,CSS))
diff --git a/javascript/jsapi.c b/javascript/jsapi.c
index ef34371..7b68fe9 100644
--- a/javascript/jsapi.c
+++ b/javascript/jsapi.c
@@ -17,14 +17,16 @@
*/
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
-
+#include "render/html_internal.h"
#include "content/content.h"
#include "javascript/content.h"
#include "javascript/js.h"
#include "utils/log.h"
+#include "window.h"
+#include "event.h"
+
static JSRuntime *rt; /* global runtime */
void js_initialise(void)
diff --git a/javascript/jsapi/binding.h b/javascript/jsapi/binding.h
deleted file mode 100644
index 7b0f614..0000000
--- a/javascript/jsapi/binding.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2012 Vincent Sanders <vince(a)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
- * spidermonkey jsapi class bindings
- */
-
-#ifndef _NETSURF_JAVASCRIPT_JSAPI_BINDING_H_
-#define _NETSURF_JAVASCRIPT_JSAPI_BINDING_H_
-
-
-#include "render/html_internal.h"
-
-JSObject *jsapi_InitClass_Window(JSContext *cx, JSObject *parent);
-
-/** Create a new javascript window object
- *
- * @param cx The javascript context.
- * @param parent The parent object or NULL for new global
- * @param win_priv The private context to set on the object
- * @return new javascript object or NULL on error
- */
-JSObject *jsapi_new_Window(JSContext *cx,
- JSObject *window,
- JSObject *parent,
- struct browser_window *bw,
- html_content *htmlc);
-
-JSObject *jsapi_InitClass_Location(JSContext *cx, JSObject *parent);
-JSObject *jsapi_new_Location(JSContext *cx,
- JSObject *window,
- JSObject *parent,
- nsurl *url,
- html_content *htmlc);
-
-
-JSObject *jsapi_InitClass_Document(JSContext *cx, JSObject *parent);
-
-/** Create a new javascript document object
- *
- * @param cx The javascript context.
- * @param parent The parent object, usually a global window object
- * @param doc_priv The private context to set on the object
- * @return new javascript object or NULL on error
- */
-JSObject *jsapi_new_Document(JSContext *cx,
- JSObject *proto,
- JSObject *parent,
- dom_document *node,
- struct html_content *htmlc);
-
-JSObject *jsapi_InitClass_Console(JSContext *cx, JSObject *parent);
-/** Create a new javascript console object
- *
- * @param cx The javascript context.
- * @param parent The parent object, usually a global window object
- * @return new javascript object or NULL on error
- */
-JSObject *jsapi_new_Console(JSContext *cx, JSObject *prototype, JSObject *parent);
-
-
-JSObject *jsapi_InitClass_Navigator(JSContext *cx, JSObject *parent);
-/** Create a new javascript navigator object
- *
- * @param cx The javascript context.
- * @param parent The parent object, usually a global window object
- * @return new javascript object or NULL on error
- */
-JSObject *jsapi_new_Navigator(JSContext *cx, JSObject *proto, JSObject *parent);
-
-extern JSClass JSClass_HTMLElement;
-
-JSObject *jsapi_InitClass_HTMLElement(JSContext *cx, JSObject *parent);
-/** Create a new javascript element object
- *
- * @param cx The javascript context.
- * @param parent The parent object, usually a global window object
- * @param doc_priv The private context to set on the object
- * @return new javascript object or NULL on error
- */
-JSObject *jsapi_new_HTMLElement(JSContext *cx,
- JSObject *prototype,
- JSObject *parent,
- dom_element *node,
- struct html_content *htmlc);
-
-JSObject *jsapi_InitClass_HTMLCollection(JSContext *cx, JSObject *parent);
-/** Create a new javascript element object
- *
- * @param cx The javascript context.
- * @param parent The parent object, usually a global window object
- * @param doc_priv The private context to set on the object
- * @return new javascript object or NULL on error
- */
-JSObject *jsapi_new_HTMLCollection(JSContext *cx,
- JSObject *prototype,
- JSObject *parent,
- dom_html_collection *collection,
- struct html_content *htmlc);
-
-JSObject *jsapi_InitClass_NodeList(JSContext *cx, JSObject *parent);
-/** Create a new javascript element object
- *
- * @param cx The javascript context.
- * @param parent The parent object, usually a global window object
- * @param doc_priv The private context to set on the object
- * @return new javascript object or NULL on error
- */
-JSObject *jsapi_new_NodeList(JSContext *cx,
- JSObject *prototype,
- JSObject *parent,
- dom_nodelist *nodelist,
- struct html_content *htmlc);
-
-
-extern JSClass JSClass_Text;
-
-JSObject *jsapi_InitClass_Text(JSContext *cx, JSObject *parent);
-/** Create a new javascript text object
- *
- * @param cx The javascript context.
- * @param parent The parent object, usually a global window object
- * @param node The dom node to use in the object
- * @return new javascript object or NULL on error
- */
-JSObject *jsapi_new_Text(JSContext *cx,
- JSObject *prototype,
- JSObject *parent,
- dom_text *node,
- struct html_content *htmlc);
-
-JSObject *jsapi_InitClass_Node(JSContext *cx, JSObject *parent);
-JSObject *jsapi_new_Node(JSContext *cx,
- JSObject *prototype,
- JSObject *parent);
-
-extern JSClass JSClass_Event;
-JSObject *jsapi_InitClass_Event(JSContext *cx, JSObject *parent);
-JSObject *jsapi_new_Event(JSContext *cx,
- JSObject *prototype,
- JSObject *parent,
- dom_event *event);
-
-#endif
diff --git a/javascript/jsapi/console.bnd b/javascript/jsapi/console.bnd
index 7c34845..9b3d21f 100644
--- a/javascript/jsapi/console.bnd
+++ b/javascript/jsapi/console.bnd
@@ -19,9 +19,9 @@ preamble %{
#include "utils/config.h"
#include "utils/log.h"
-
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+
+#include "console.h"
%}
diff --git a/javascript/jsapi/event.bnd b/javascript/jsapi/event.bnd
index cc03c92..b8b0aff 100644
--- a/javascript/jsapi/event.bnd
+++ b/javascript/jsapi/event.bnd
@@ -16,14 +16,15 @@ hdrcomment "Released under the terms of the MIT License,";
hdrcomment " http://www.opensource.org/licenses/mit-license";
preamble %{
+#include <stdlib.h>
#include <dom/dom.h>
#include "utils/config.h"
#include "utils/log.h"
-
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+
+#include "event.h"
%}
diff --git a/javascript/jsapi/htmlcollection.bnd b/javascript/jsapi/htmlcollection.bnd
index 5e99e48..38e14ed 100644
--- a/javascript/jsapi/htmlcollection.bnd
+++ b/javascript/jsapi/htmlcollection.bnd
@@ -23,9 +23,11 @@ preamble %{
#include "utils/config.h"
#include "utils/log.h"
-
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+#include "render/html_internal.h"
+
+#include "htmlelement.h"
+#include "htmlcollection.h"
%}
diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd
index c29e470..ddf408a 100644
--- a/javascript/jsapi/htmldocument.bnd
+++ b/javascript/jsapi/htmldocument.bnd
@@ -25,12 +25,16 @@ preamble %{
#include "utils/log.h"
#include "utils/corestrings.h"
#include "utils/libdom.h"
-
#include "content/urldb.h"
-
#include "javascript/js.h"
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+#include "render/html_internal.h"
+
+#include "htmldocument.h"
+#include "htmlelement.h"
+#include "text.h"
+#include "nodelist.h"
+#include "location.h"
%}
diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd
index 3ede93b..48ebbdb 100644
--- a/javascript/jsapi/htmlelement.bnd
+++ b/javascript/jsapi/htmlelement.bnd
@@ -24,10 +24,13 @@ preamble %{
#include "utils/config.h"
#include "utils/log.h"
#include "utils/corestrings.h"
-
#include "javascript/js.h"
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+#include "render/html_internal.h"
+
+#include "htmlelement.h"
+#include "text.h"
+#include "location.h"
%}
diff --git a/javascript/jsapi/location.bnd b/javascript/jsapi/location.bnd
index 32677d1..85117a2 100644
--- a/javascript/jsapi/location.bnd
+++ b/javascript/jsapi/location.bnd
@@ -21,9 +21,10 @@ preamble %{
#include "utils/config.h"
#include "utils/log.h"
-
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+#include "render/html_internal.h"
+
+#include "location.h"
%}
diff --git a/javascript/jsapi/navigator.bnd b/javascript/jsapi/navigator.bnd
index e63e9a9..d040ede 100644
--- a/javascript/jsapi/navigator.bnd
+++ b/javascript/jsapi/navigator.bnd
@@ -24,14 +24,13 @@ preamble %{
#include "desktop/netsurf.h"
#include "desktop/options.h"
-
#include "utils/config.h"
#include "utils/useragent.h"
#include "utils/log.h"
#include "utils/utsname.h"
-
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+
+#include "navigator.h"
/*
* navigator properties for netsurf
diff --git a/javascript/jsapi/node.bnd b/javascript/jsapi/node.bnd
index bcf0ef7..49fd06b 100644
--- a/javascript/jsapi/node.bnd
+++ b/javascript/jsapi/node.bnd
@@ -23,7 +23,8 @@ preamble %{
#include "utils/log.h"
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+
+#include "node.h"
%}
diff --git a/javascript/jsapi/nodelist.bnd b/javascript/jsapi/nodelist.bnd
index b57dc6e..4aa8c47 100644
--- a/javascript/jsapi/nodelist.bnd
+++ b/javascript/jsapi/nodelist.bnd
@@ -20,9 +20,11 @@ preamble %{
#include "utils/config.h"
#include "utils/log.h"
-
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+#include "render/html_internal.h"
+
+#include "nodelist.h"
+#include "htmlelement.h"
%}
diff --git a/javascript/jsapi/text.bnd b/javascript/jsapi/text.bnd
index 42791d0..6b43521 100644
--- a/javascript/jsapi/text.bnd
+++ b/javascript/jsapi/text.bnd
@@ -23,9 +23,11 @@ preamble %{
#include "utils/config.h"
#include "utils/log.h"
-
+#include "render/html_internal.h"
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+
+#include "text.h"
+#include "htmlelement.h"
%}
diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd
index 6153e90..288b5b3 100644
--- a/javascript/jsapi/window.bnd
+++ b/javascript/jsapi/window.bnd
@@ -24,10 +24,20 @@ preamble %{
#include "utils/config.h"
#include "utils/log.h"
#include "utils/corestrings.h"
-
+#include "render/html_internal.h"
#include "javascript/jsapi.h"
-#include "javascript/jsapi/binding.h"
+#include "console.h"
+#include "navigator.h"
+#include "event.h"
+#include "node.h"
+#include "htmlcollection.h"
+#include "nodelist.h"
+#include "htmldocument.h"
+#include "text.h"
+#include "htmlelement.h"
+#include "window.h"
+#include "location.h"
%}
diff --git a/monkey/Makefile.target b/monkey/Makefile.target
index fa15a50..05a32d0 100644
--- a/monkey/Makefile.target
+++ b/monkey/Makefile.target
@@ -41,7 +41,7 @@ MONKEYCFLAGS := -std=c99 -Dmonkey -Dnsmonkey \
-D_POSIX_C_SOURCE=200112L \
-D_NETBSD_SOURCE \
-DMONKEY_RESPATH=\"$(NETSURF_MONKEY_RESOURCES)\" \
- $(WARNFLAGS) -I. -g \
+ $(WARNFLAGS) -g \
$(shell $(PKG_CONFIG) --cflags glib-2.0) \
$(shell $(PKG_CONFIG) --cflags libdom libcurl) \
$(shell $(PKG_CONFIG) --cflags openssl) \
diff --git a/riscos/Makefile.target b/riscos/Makefile.target
index e7370e7..faefa41 100644
--- a/riscos/Makefile.target
+++ b/riscos/Makefile.target
@@ -42,12 +42,10 @@ TPD_RISCOS = $(foreach TPL,$(notdir $(TPL_RISCOS)), \
RESOURCES = $(TPD_RISCOS) split-messages
-CFLAGS += -I. $(WARNFLAGS) -Driscos \
- -std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE \
- -mpoke-function-name -fno-strict-aliasing
+CFLAGS += $(WARNFLAGS) -Driscos -std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE \
+ -mpoke-function-name -fno-strict-aliasing
-CFLAGS += -I$(GCCSDK_INSTALL_ENV)/include \
- -I$(GCCSDK_INSTALL_ENV)/include/libmng
+CFLAGS += -I$(GCCSDK_INSTALL_ENV)/include -I$(GCCSDK_INSTALL_ENV)/include/libmng
ifeq ($(HOST),riscos)
CFLAGS += -I<OSLib$$Dir> -mthrowback
endif
diff --git a/windows/Makefile.target b/windows/Makefile.target
index 90f97fb..33a9492 100644
--- a/windows/Makefile.target
+++ b/windows/Makefile.target
@@ -3,48 +3,51 @@
#
# This file is part of NetSurf
- LDFLAGS += -L${GCCSDK_INSTALL_ENV}/lib
- CFLAGS += -I${GCCSDK_INSTALL_ENV}/include/
-
- NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
- NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
- NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
- NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
- NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
- $(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,BMP (libnsbmp)))
- $(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif)))
- $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
- $(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
- $(eval $(call feature_enabled,MNG,,-llcms -ljpeg,PNG/JNG/MNG (libmng)))
-
- ifneq ($(PKG_CONFIG),)
- CFLAGS += $(shell $(PKG_CONFIG) --cflags zlib libcares libcurl libhubbub \
- libparserutils libdom libwapcaplet)
- LDFLAGS += $(shell $(PKG_CONFIG) --libs zlib libcurl libcares \
- libhubbub libparserutils libcss libdom libwapcaplet)
- else
- LDFLAGS += -lhubbub -lcss -lparserutils -lwapcaplet -lcurl -lz
- endif
-
- LDFLAGS += -lssl -lcrypto -lregex -liconv \
+LDFLAGS += -L${GCCSDK_INSTALL_ENV}/lib
+CFLAGS += -I${GCCSDK_INSTALL_ENV}/include/
+
+NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
+NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
+NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
+NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
+NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
+
+$(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,BMP (libnsbmp)))
+$(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif)))
+$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
+$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
+$(eval $(call feature_enabled,MNG,,-llcms -ljpeg,PNG/JNG/MNG (libmng)))
+
+ifneq ($(PKG_CONFIG),)
+ $(eval $(call pkg_config_find_and_add,zlib,ZLib))
+ $(eval $(call pkg_config_find_and_add,libcurl,Curl))
+ $(eval $(call pkg_config_find_and_add,libcares,Cares))
+ $(eval $(call pkg_config_find_and_add,libwapcaplet,Wapcaplet))
+ $(eval $(call pkg_config_find_and_add,libparserutils,Parserutils))
+ $(eval $(call pkg_config_find_and_add,libhubbub,Hubbub))
+ $(eval $(call pkg_config_find_and_add,libdom,DOM))
+ $(eval $(call pkg_config_find_and_add,libcss,CSS))
+else
+ LDFLAGS += -lhubbub -lcss -lparserutils -lwapcaplet -lcurl -lz
+endif
+
+LDFLAGS += -lssl -lcrypto -lregex -liconv \
-lgdi32 -lcomctl32 -lws2_32 -lmsimg32 -mwindows
- CFLAGS += -U__STRICT_ANSI__ -mwin32
- # only windows versions after XP are supported
- CFLAGS += '-DWINVER=0x0501'
- CFLAGS += '-D_WIN32_WINNT=0x0501'
- CFLAGS += '-D_WIN32_WINDOWS=0x0501'
- CFLAGS += '-D_WIN32_IE=0x0501'
+CFLAGS += -U__STRICT_ANSI__ -mwin32
+# only windows versions after XP are supported
+CFLAGS += '-DWINVER=0x0501'
+CFLAGS += '-D_WIN32_WINNT=0x0501'
+CFLAGS += '-D_WIN32_WINDOWS=0x0501'
+CFLAGS += '-D_WIN32_IE=0x0501'
- #installed resource path
- CFLAGS += '-DNETSURF_WINDOWS_RESPATH="$(NETSURF_WINDOWS_RESPATH)"'
+#installed resource path
+CFLAGS += '-DNETSURF_WINDOWS_RESPATH="$(NETSURF_WINDOWS_RESPATH)"'
+WSCFLAGS := -std=c99 $(WARNFLAGS) -DCURL_STATICLIB -DCARES_STATICLIB -g
- WSCFLAGS := -std=c99 \
- $(WARNFLAGS) -I. \
- -DCURL_STATICLIB -DCARES_STATICLIB -g
- CFLAGS += $(WSCFLAGS)
- LDFLAGS += $(WSCFLAGS)
+CFLAGS += $(WSCFLAGS)
+LDFLAGS += $(WSCFLAGS)
# ----------------------------------------------------------------------------
# built-in resource setup
--
NetSurf Browser
10 years, 11 months
netsurf: branch mono/interactive-about_config updated. 15f8a056d5daca0600fbb11485060ac3337ffebe
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/15f8a056d5daca0600fbb...
...commit http://git.netsurf-browser.org/netsurf.git/commit/15f8a056d5daca0600fbb11...
...tree http://git.netsurf-browser.org/netsurf.git/tree/15f8a056d5daca0600fbb1148...
The branch, mono/interactive-about_config has been updated
via 15f8a056d5daca0600fbb11485060ac3337ffebe (commit)
from f72305504d83034e0350d9291fdf8f54641ab764 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/15f8a056d5daca0600f...
commit 15f8a056d5daca0600fbb11485060ac3337ffebe
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Fixed typo
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index f0d7c9e..f514b1c 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -321,7 +321,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
while (post_item != NULL) {
if (strcmp(post_item->name, "token") == 0
- && sctrcmp(post_item->value, token) == 0) {
+ && strcmp(post_item->value, token) == 0) {
valid_token = true;
if (do_save == true) {
break;
@@ -329,7 +329,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
}
if (strcmp(post_item->name, "action") == 0
- && sctrcmp(post_item->value, "Save") == 0) {
+ && strcmp(post_item->value, "Save") == 0) {
do_save = true;
if (valid_token == true) {
break;
diff --git a/desktop/options.c b/desktop/options.c
index eec3f7d..4bdac6d 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -317,7 +317,7 @@ nsoption_output_value_html_input(struct option_entry_s *option,
"<input type=\"text\" name=\"%s\" value=\"%06x\"/> "
"<span style=\"background-color: #%06x; color: #%06x; \">"
" </span>",
- option->, rgbcolour,
+ option->key, rgbcolour,
rgbcolour, (~rgbcolour) & 0xffffff);
break;
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about.c | 4 ++--
desktop/options.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index f0d7c9e..f514b1c 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -321,7 +321,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
while (post_item != NULL) {
if (strcmp(post_item->name, "token") == 0
- && sctrcmp(post_item->value, token) == 0) {
+ && strcmp(post_item->value, token) == 0) {
valid_token = true;
if (do_save == true) {
break;
@@ -329,7 +329,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
}
if (strcmp(post_item->name, "action") == 0
- && sctrcmp(post_item->value, "Save") == 0) {
+ && strcmp(post_item->value, "Save") == 0) {
do_save = true;
if (valid_token == true) {
break;
diff --git a/desktop/options.c b/desktop/options.c
index eec3f7d..4bdac6d 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -317,7 +317,7 @@ nsoption_output_value_html_input(struct option_entry_s *option,
"<input type=\"text\" name=\"%s\" value=\"%06x\"/> "
"<span style=\"background-color: #%06x; color: #%06x; \">"
" </span>",
- option->, rgbcolour,
+ option->key, rgbcolour,
rgbcolour, (~rgbcolour) & 0xffffff);
break;
--
NetSurf Browser
10 years, 11 months
netsurf: branch mono/interactive-about_config updated. f72305504d83034e0350d9291fdf8f54641ab764
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/f72305504d83034e0350d...
...commit http://git.netsurf-browser.org/netsurf.git/commit/f72305504d83034e0350d92...
...tree http://git.netsurf-browser.org/netsurf.git/tree/f72305504d83034e0350d9291...
The branch, mono/interactive-about_config has been updated
via f72305504d83034e0350d9291fdf8f54641ab764 (commit)
from 3bc7316ac8873d8b17ceef66168dfa5bb14928ff (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/f72305504d83034e035...
commit f72305504d83034e0350d9291fdf8f54641ab764
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Use multipart/form-data for data transmission.
Requires some new nsoption functions to be saved.
(Conversion -> option name to index)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 81ff2e1..f0d7c9e 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -71,6 +71,8 @@ struct fetch_about_context {
nsurl *url; /**< The full url the fetch refers to */
+ struct fetch_multipart_data *post_multipart; /**< Form data */
+
fetch_about_handler handler;
};
@@ -309,7 +311,43 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
int res = 0;
lwc_string *path;
url_func_result status;
+ struct fetch_multipart_data *post_item;
+ bool do_save = false;
+ bool valid_token = false;
+ char token[9] = {"12345678"};
+
+ /* save settings: */
+ post_item = ctx->post_multipart;
+ while (post_item != NULL) {
+
+ if (strcmp(post_item->name, "token") == 0
+ && sctrcmp(post_item->value, token) == 0) {
+ valid_token = true;
+ if (do_save == true) {
+ break;
+ }
+ }
+
+ if (strcmp(post_item->name, "action") == 0
+ && sctrcmp(post_item->value, "Save") == 0) {
+ do_save = true;
+ if (valid_token == true) {
+ break;
+ }
+ }
+ post_item = post_item->next;
+ }
+ if (do_save && valid_token) {
+ int opt = 0;
+ post_item = ctx->post_multipart;
+ while (post_item != NULL) {
+ printf("%s -> %s\n", post_item->name, post_item->value);
+ //opt = nsoption_get_index(post_item->name);
+ //nsoption_get_type(opt);
+ post_item = post_item->next;
+ }
+ }
/* content is going to return ok */
fetch_set_http_code(ctx->fetchh, code);
@@ -335,14 +373,15 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
"</p>\n"
"<h1>NetSurf Browser Config</h1>\n"
#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
- "<form action=\"about:config\" method=\"GET\">"
+ "<form action=\"about:config\" method=\"POST\""
+ " enctype=\"multipart/form-data\">"
#endif
"<table class=\"config\">\n"
"<tr><th></th><th></th><th></th></tr>\n");
do {
#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
- res = nsoption_snoptionf(buffer + slen, sizeof buffer - slen,
+ res = nsoption_snoptionf(buffer + slen, sizeof buffer - slen,
opt_loop,
"<tr><th>%k</th><td>%t</td><td>%I</td></tr>\n");
#else
@@ -371,12 +410,13 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
"</table>\n");
slen += snprintf(buffer + slen, sizeof buffer - slen,
"<br/><center>"
- "<input type=\"hidden\" name=\"token\" value=\"\" />\n"
+ "<input type=\"hidden\" name=\"token\" value=\"%s\" />\n"
"<input type=\"submit\" name=\"action\" value=\"Save\" />\n"
"<input type=\"submit\" name=\"action\" value=\"Abort\" />\n"
"</center><br/>\n"
"</form>\n"
- "</table>\n</body>\n</html>\n");
+ "</table>\n</body>\n</html>\n",
+ token);
#else
slen += snprintf(buffer + slen, sizeof buffer - slen,
"</table>\n</body>\n</html>\n");
@@ -788,6 +828,10 @@ fetch_about_setup(struct fetch *fetchh,
ctx->fetchh = fetchh;
ctx->url = nsurl_ref(url);
+ if (post_multipart != NULL) {
+ ctx->post_multipart = fetch_multipart_data_clone(post_multipart);
+ }
+
RING_INSERT(ring, ctx);
return ctx;
@@ -797,6 +841,9 @@ fetch_about_setup(struct fetch *fetchh,
static void fetch_about_free(void *ctx)
{
struct fetch_about_context *c = ctx;
+ if (c->post_multipart) {
+ fetch_multipart_data_destroy(c->post_multipart);
+ }
nsurl_unref(c->url);
RING_REMOVE(ring, c);
free(ctx);
diff --git a/desktop/options.c b/desktop/options.c
index 4bdac6d..eec3f7d 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -317,7 +317,7 @@ nsoption_output_value_html_input(struct option_entry_s *option,
"<input type=\"text\" name=\"%s\" value=\"%06x\"/> "
"<span style=\"background-color: #%06x; color: #%06x; \">"
" </span>",
- option->key, rgbcolour,
+ option->, rgbcolour,
rgbcolour, (~rgbcolour) & 0xffffff);
break;
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about.c | 55 ++++++++++++++++++++++++++++++++++++++++++---
desktop/options.c | 2 +-
2 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 81ff2e1..f0d7c9e 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -71,6 +71,8 @@ struct fetch_about_context {
nsurl *url; /**< The full url the fetch refers to */
+ struct fetch_multipart_data *post_multipart; /**< Form data */
+
fetch_about_handler handler;
};
@@ -309,7 +311,43 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
int res = 0;
lwc_string *path;
url_func_result status;
+ struct fetch_multipart_data *post_item;
+ bool do_save = false;
+ bool valid_token = false;
+ char token[9] = {"12345678"};
+
+ /* save settings: */
+ post_item = ctx->post_multipart;
+ while (post_item != NULL) {
+
+ if (strcmp(post_item->name, "token") == 0
+ && sctrcmp(post_item->value, token) == 0) {
+ valid_token = true;
+ if (do_save == true) {
+ break;
+ }
+ }
+
+ if (strcmp(post_item->name, "action") == 0
+ && sctrcmp(post_item->value, "Save") == 0) {
+ do_save = true;
+ if (valid_token == true) {
+ break;
+ }
+ }
+ post_item = post_item->next;
+ }
+ if (do_save && valid_token) {
+ int opt = 0;
+ post_item = ctx->post_multipart;
+ while (post_item != NULL) {
+ printf("%s -> %s\n", post_item->name, post_item->value);
+ //opt = nsoption_get_index(post_item->name);
+ //nsoption_get_type(opt);
+ post_item = post_item->next;
+ }
+ }
/* content is going to return ok */
fetch_set_http_code(ctx->fetchh, code);
@@ -335,14 +373,15 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
"</p>\n"
"<h1>NetSurf Browser Config</h1>\n"
#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
- "<form action=\"about:config\" method=\"GET\">"
+ "<form action=\"about:config\" method=\"POST\""
+ " enctype=\"multipart/form-data\">"
#endif
"<table class=\"config\">\n"
"<tr><th></th><th></th><th></th></tr>\n");
do {
#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
- res = nsoption_snoptionf(buffer + slen, sizeof buffer - slen,
+ res = nsoption_snoptionf(buffer + slen, sizeof buffer - slen,
opt_loop,
"<tr><th>%k</th><td>%t</td><td>%I</td></tr>\n");
#else
@@ -371,12 +410,13 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
"</table>\n");
slen += snprintf(buffer + slen, sizeof buffer - slen,
"<br/><center>"
- "<input type=\"hidden\" name=\"token\" value=\"\" />\n"
+ "<input type=\"hidden\" name=\"token\" value=\"%s\" />\n"
"<input type=\"submit\" name=\"action\" value=\"Save\" />\n"
"<input type=\"submit\" name=\"action\" value=\"Abort\" />\n"
"</center><br/>\n"
"</form>\n"
- "</table>\n</body>\n</html>\n");
+ "</table>\n</body>\n</html>\n",
+ token);
#else
slen += snprintf(buffer + slen, sizeof buffer - slen,
"</table>\n</body>\n</html>\n");
@@ -788,6 +828,10 @@ fetch_about_setup(struct fetch *fetchh,
ctx->fetchh = fetchh;
ctx->url = nsurl_ref(url);
+ if (post_multipart != NULL) {
+ ctx->post_multipart = fetch_multipart_data_clone(post_multipart);
+ }
+
RING_INSERT(ring, ctx);
return ctx;
@@ -797,6 +841,9 @@ fetch_about_setup(struct fetch *fetchh,
static void fetch_about_free(void *ctx)
{
struct fetch_about_context *c = ctx;
+ if (c->post_multipart) {
+ fetch_multipart_data_destroy(c->post_multipart);
+ }
nsurl_unref(c->url);
RING_REMOVE(ring, c);
free(ctx);
diff --git a/desktop/options.c b/desktop/options.c
index 4bdac6d..eec3f7d 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -317,7 +317,7 @@ nsoption_output_value_html_input(struct option_entry_s *option,
"<input type=\"text\" name=\"%s\" value=\"%06x\"/> "
"<span style=\"background-color: #%06x; color: #%06x; \">"
" </span>",
- option->key, rgbcolour,
+ option->, rgbcolour,
rgbcolour, (~rgbcolour) & 0xffffff);
break;
--
NetSurf Browser
10 years, 11 months
netsurf: branch mono/interactive-about_config updated. 3bc7316ac8873d8b17ceef66168dfa5bb14928ff
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/3bc7316ac8873d8b17cee...
...commit http://git.netsurf-browser.org/netsurf.git/commit/3bc7316ac8873d8b17ceef6...
...tree http://git.netsurf-browser.org/netsurf.git/tree/3bc7316ac8873d8b17ceef661...
The branch, mono/interactive-about_config has been updated
via 3bc7316ac8873d8b17ceef66168dfa5bb14928ff (commit)
from 0d803b6c0d252c3a1a9fa07e37d9a0b08ce567b8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/3bc7316ac8873d8b17c...
commit 3bc7316ac8873d8b17ceef66168dfa5bb14928ff
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Render HTML Form for Choices submission.
Causes memory corruption when submitted via GET.
Retrieving Post data requires a bit more indepth
knowledge about the fetcher.
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 78f22df..81ff2e1 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* about: URL handling.
+/* about: URL handling.
*
- * Based on the data fetcher by Rob Kendrick
+ * Based on the data fetcher by Rob Kendrick
* This fetcher provides a simple scheme for the user to access
* information from the browser from a known, fixed URL.
*/
@@ -198,7 +198,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
msg.data.header_or_data.buf = (const uint8_t *) buffer;
/* page head */
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"<html>\n<head>\n"
"<title>NetSurf Browser Image Cache Status</title>\n"
"<link rel=\"stylesheet\" type=\"text/css\" "
@@ -215,7 +215,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
goto fetch_about_imagecache_handler_aborted;
/* image cache summary */
- slen = image_cache_snsummaryf(buffer, sizeof(buffer),
+ slen = image_cache_snsummaryf(buffer, sizeof(buffer),
"<p>Configured limit of %a hysteresis of %b</p>\n"
"<p>Total bitmap size in use %c (in %d)</p>\n"
"<p>Age %es</p>\n"
@@ -224,7 +224,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
"<p>Cache total/hit/miss/fail (counts) %j/%k/%l/%m "
"(%pj%%/%pk%%/%pl%%/%pm%%)</p>\n"
"<p>Cache total/hit/miss/fail (size) %n/%o/%q/%r "
- "(%pn%%/%po%%/%pq%%/%pr%%)</p>\n"
+ "(%pn%%/%po%%/%pq%%/%pr%%)</p>\n"
"<p>Total images never rendered: %s "
"(includes %t that were converted)</p>\n"
"<p>Total number of excessive conversions: %u "
@@ -232,7 +232,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
"</p>\n"
"<p>Bitmap of size %w had most (%x) conversions</p>\n"
"<h2>Current image cache contents</h2>\n");
- if (slen >= (int) (sizeof(buffer)))
+ if (slen >= (int) (sizeof(buffer)))
goto fetch_about_imagecache_handler_aborted; /* overflow */
msg.data.header_or_data.len = slen;
@@ -241,7 +241,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
/* image cache entry table */
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"<p class=\"imagecachelist\">\n"
"<strong>"
"<span>Entry</span>"
@@ -266,7 +266,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
"<span>%s</span>"
"<span>%o</span>"
"</a>\n");
- if (res <= 0)
+ if (res <= 0)
break; /* last option */
if (res >= (int) (sizeof buffer - slen)) {
@@ -282,7 +282,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
}
} while (res > 0);
- slen += snprintf(buffer + slen, sizeof buffer - slen,
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
"</p>\n</body>\n</html>\n");
msg.data.header_or_data.len = slen;
@@ -307,6 +307,9 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
int slen;
unsigned int opt_loop = 0;
int res = 0;
+ lwc_string *path;
+ url_func_result status;
+
/* content is going to return ok */
fetch_set_http_code(ctx->fetchh, code);
@@ -318,7 +321,8 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
- slen = snprintf(buffer, sizeof buffer,
+#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1
+ slen = snprintf(buffer, sizeof buffer,
"<html>\n<head>\n"
"<title>NetSurf Browser Config</title>\n"
"<link rel=\"stylesheet\" type=\"text/css\" "
@@ -330,14 +334,23 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
"<img src=\"resource:netsurf.png\" alt=\"NetSurf\"></a>"
"</p>\n"
"<h1>NetSurf Browser Config</h1>\n"
+#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
+ "<form action=\"about:config\" method=\"GET\">"
+#endif
"<table class=\"config\">\n"
"<tr><th></th><th></th><th></th></tr>\n");
do {
+#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
+ res = nsoption_snoptionf(buffer + slen, sizeof buffer - slen,
+ opt_loop,
+ "<tr><th>%k</th><td>%t</td><td>%I</td></tr>\n");
+#else
res = nsoption_snoptionf(buffer + slen, sizeof buffer - slen,
opt_loop,
"<tr><th>%k</th><td>%t</td><td>%V</td></tr>\n");
- if (res <= 0)
+#endif
+ if (res <= 0)
break; /* last option */
if (res >= (int) (sizeof buffer - slen)) {
@@ -353,8 +366,22 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
}
} while (res > 0);
- slen += snprintf(buffer + slen, sizeof buffer - slen,
+#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
+ "</table>\n");
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
+ "<br/><center>"
+ "<input type=\"hidden\" name=\"token\" value=\"\" />\n"
+ "<input type=\"submit\" name=\"action\" value=\"Save\" />\n"
+ "<input type=\"submit\" name=\"action\" value=\"Abort\" />\n"
+ "</center><br/>\n"
+ "</form>\n"
"</table>\n</body>\n</html>\n");
+#else
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
+ "</table>\n</body>\n</html>\n");
+#endif
+
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
@@ -371,7 +398,7 @@ fetch_about_config_handler_aborted:
/** Generate the text of a Choices file which represents the current
- * in use options.
+ * in use options.
*/
static bool fetch_about_choices_handler(struct fetch_about_context *ctx)
{
@@ -392,15 +419,15 @@ static bool fetch_about_choices_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"# Automatically generated current NetSurf browser Choices\n");
do {
- res = nsoption_snoptionf(buffer + slen,
- sizeof buffer - slen,
- opt_loop,
+ res = nsoption_snoptionf(buffer + slen,
+ sizeof buffer - slen,
+ opt_loop,
"%k:%v\n");
- if (res <= 0)
+ if (res <= 0)
break; /* last option */
if (res >= (int) (sizeof buffer - slen)) {
@@ -441,7 +468,7 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
int code = 200;
int slen;
int i;
-
+
/* content is going to return ok */
fetch_set_http_code(ctx->fetchh, code);
@@ -453,14 +480,14 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"# Automatically generated by NetSurf build system\n\n");
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
- slen = snprintf(buffer, sizeof buffer,
+
+ slen = snprintf(buffer, sizeof buffer,
#if defined(WT_BRANCHISTRUNK) || defined(WT_BRANCHISMASTER)
"# This is a *DEVELOPMENT* build from the main line.\n\n"
#elif defined(WT_BRANCHISTAG) && (WT_MODIFIED == 0)
@@ -482,29 +509,29 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
#endif
);
- msg.data.header_or_data.len = slen;
+ msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
- slen = snprintf(buffer, sizeof buffer,
+
+ slen = snprintf(buffer, sizeof buffer,
"Built by %s (%s) from %s at revision %s\n\n",
GECOS, USERNAME, WT_BRANCHPATH, WT_REVID);
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
- slen = snprintf(buffer, sizeof buffer,
+
+ slen = snprintf(buffer, sizeof buffer,
"Built on %s in %s\n\n",
WT_HOSTNAME, WT_ROOT);
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
+
if (WT_MODIFIED > 0) {
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"Working tree has %d modification%s\n\n",
WT_MODIFIED, WT_MODIFIED == 1 ? "" : "s");
} else {
@@ -515,7 +542,7 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
+
for (i = 0; i < WT_MODIFIED; ++i) {
slen = snprintf(buffer, sizeof buffer,
" %s %s\n",
@@ -524,10 +551,10 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
+
}
- msg.type = FETCH_FINISHED;
+ msg.type = FETCH_FINISHED;
fetch_about_send_callback(&msg, ctx);
return true;
@@ -602,15 +629,15 @@ struct about_handlers about_handler_list[] = {
fetch_about_imagecache_handler, true },
/* The default blank page */
{ "blank", SLEN("blank"), NULL,
- fetch_about_blank_handler, true }
+ fetch_about_blank_handler, true }
};
#define about_handler_list_len (sizeof(about_handler_list) / \
sizeof(struct about_handlers))
/**
- * List all the valid about: paths available
- *
+ * List all the valid about: paths available
+ *
* \param ctx The fetch context.
* \return true for sucess or false to generate an error.
*/
@@ -633,7 +660,7 @@ static bool fetch_about_about_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"<html>\n<head>\n"
"<title>NetSurf List of About pages</title>\n"
"<link rel=\"stylesheet\" type=\"text/css\" "
@@ -653,11 +680,11 @@ static bool fetch_about_about_handler(struct fetch_about_context *ctx)
if (about_handler_list[abt_loop].hidden)
continue;
- res = snprintf(buffer + slen, sizeof buffer - slen,
- "<li><a href=\"about:%s\">about:%s</a></li>\n",
- about_handler_list[abt_loop].name,
+ res = snprintf(buffer + slen, sizeof buffer - slen,
+ "<li><a href=\"about:%s\">about:%s</a></li>\n",
+ about_handler_list[abt_loop].name,
about_handler_list[abt_loop].name);
- if (res <= 0)
+ if (res <= 0)
break; /* last option */
if (res >= (int)(sizeof buffer - slen)) {
@@ -672,7 +699,7 @@ static bool fetch_about_about_handler(struct fetch_about_context *ctx)
}
}
- slen += snprintf(buffer + slen, sizeof buffer - slen,
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
"</ul>\n</body>\n</html>\n");
msg.data.header_or_data.len = slen;
@@ -696,8 +723,8 @@ static bool fetch_about_initialise(lwc_string *scheme)
lwc_error error;
for (abt_loop = 0; abt_loop < about_handler_list_len; abt_loop++) {
- error = lwc_intern_string(about_handler_list[abt_loop].name,
- about_handler_list[abt_loop].name_len,
+ error = lwc_intern_string(about_handler_list[abt_loop].name,
+ about_handler_list[abt_loop].name_len,
&about_handler_list[abt_loop].lname);
if (error != lwc_error_ok) {
while (abt_loop-- != 0) {
@@ -744,15 +771,15 @@ fetch_about_setup(struct fetch *fetchh,
path = nsurl_get_component(url, NSURL_PATH);
- for (handler_loop = 0;
- handler_loop < about_handler_list_len;
+ for (handler_loop = 0;
+ handler_loop < about_handler_list_len;
handler_loop++) {
ctx->handler = about_handler_list[handler_loop].handler;
- if (lwc_string_isequal(path,
- about_handler_list[handler_loop].lname,
+ if (lwc_string_isequal(path,
+ about_handler_list[handler_loop].lname,
&match) == lwc_error_ok && match) {
break;
- }
+ }
}
if (path != NULL)
diff --git a/desktop/options.c b/desktop/options.c
index 2a080d5..4bdac6d 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -67,7 +67,7 @@ struct option_entry_s option_table[] = {
/**
* Set an option value based on a string
*/
-static bool
+static bool
strtooption(const char *value, struct option_entry_s *option_entry)
{
bool ret = false;
@@ -188,12 +188,12 @@ void nsoption_write(const char *path)
for (entry = 0; entry != option_table_entries; entry++) {
switch (option_table[entry].type) {
case OPTION_BOOL:
- fprintf(fp, "%s:%c\n", option_table[entry].key,
+ fprintf(fp, "%s:%c\n", option_table[entry].key,
*((bool *) option_table[entry].p) ? '1' : '0');
break;
case OPTION_INTEGER:
- fprintf(fp, "%s:%i\n", option_table[entry].key,
+ fprintf(fp, "%s:%i\n", option_table[entry].key,
*((int *) option_table[entry].p));
break;
@@ -204,12 +204,12 @@ void nsoption_write(const char *path)
option_table[entry].p)) << 0) |
((0x00FF0000 & *((colour *)
option_table[entry].p)) >> 16);
- fprintf(fp, "%s:%06x\n", option_table[entry].key,
+ fprintf(fp, "%s:%06x\n", option_table[entry].key,
rgbcolour);
break;
case OPTION_STRING:
- if (((*((char **) option_table[entry].p)) != NULL) &&
+ if (((*((char **) option_table[entry].p)) != NULL) &&
(*(*((char **) option_table[entry].p)) != 0)) {
fprintf(fp, "%s:%s\n", option_table[entry].key,
*((char **) option_table[entry].p));
@@ -231,7 +231,7 @@ void nsoption_write(const char *path)
* \param string The string in which to output the value.
* \return The number of bytes written to string or -1 on error
*/
-static size_t
+static size_t
nsoption_output_value_html(struct option_entry_s *option,
size_t size, size_t pos, char *string)
{
@@ -274,6 +274,66 @@ nsoption_output_value_html(struct option_entry_s *option,
return slen;
}
+/**
+ * Output an option value into a string, in HTML form element format.
+ *
+ * \param option The option to output the value of.
+ * \param size The size of the string buffer.
+ * \param pos The current position in string
+ * \param string The string in which to output the value.
+ * \return The number of bytes written to string or -1 on error
+ */
+static size_t
+nsoption_output_value_html_input(struct option_entry_s *option,
+ size_t size, size_t pos, char *string)
+{
+ size_t slen = 0; /* length added to string */
+ colour rgbcolour; /* RRGGBB */
+ char hexcolour[7];
+
+ switch (option->type) {
+ case OPTION_BOOL:
+ slen = snprintf(string + pos, size - pos,
+ "<select name=\"%s\">"
+ "<option value=1 %s>Enabled"
+ "<option value=0 %s>Disabled"
+ "</select>",
+ option->key,
+ *((bool *)option->p) ? "selected" : "",
+ *((bool *)option->p) ? "" : "selected");
+ break;
+
+ case OPTION_INTEGER:
+ slen = snprintf(string + pos, size - pos,
+ "<input type=\"text\" name=\"%s\" value=\"%i\"/>",
+ option->key, *((int *)option->p));
+ break;
+
+ case OPTION_COLOUR:
+ rgbcolour = ((0x000000FF & *((colour *) option->p)) << 16) |
+ ((0x0000FF00 & *((colour *) option->p)) << 0) |
+ ((0x00FF0000 & *((colour *) option->p)) >> 16);
+ slen = snprintf(string + pos, size - pos,
+ "<input type=\"text\" name=\"%s\" value=\"%06x\"/> "
+ "<span style=\"background-color: #%06x; color: #%06x; \">"
+ " </span>",
+ option->key, rgbcolour,
+ rgbcolour, (~rgbcolour) & 0xffffff);
+ break;
+
+ case OPTION_STRING:
+ slen = snprintf(string + pos, size - pos,
+ "<input type=\"text\" name=\"%s\" value=\"%s\"/>",
+ option->key,
+ (*((char **)option->p) != NULL) ?
+ *((char **)option->p) :
+ "NULL");
+ break;
+ }
+
+ return slen;
+}
+
/**
* Output an option value into a string, in plain text format.
@@ -284,7 +344,7 @@ nsoption_output_value_html(struct option_entry_s *option,
* \param string The string in which to output the value.
* \return The number of bytes written to string or -1 on error
*/
-static size_t
+static size_t
nsoption_output_value_text(struct option_entry_s *option,
size_t size, size_t pos, char *string)
{
@@ -321,7 +381,7 @@ nsoption_output_value_text(struct option_entry_s *option,
}
/* exported interface documented in options.h */
-void
+void
nsoption_commandline(int *pargc, char **argv)
{
char *arg;
@@ -360,14 +420,14 @@ nsoption_commandline(int *pargc, char **argv)
LOG(("%.*s = %s",arglen,arg,val));
- for (entry_loop = 0;
- entry_loop < option_table_entries;
+ for (entry_loop = 0;
+ entry_loop < option_table_entries;
entry_loop++) {
- if (strncmp(arg, option_table[entry_loop].key,
- arglen) == 0) {
+ if (strncmp(arg, option_table[entry_loop].key,
+ arglen) == 0) {
strtooption(val, option_table + entry_loop);
break;
- }
+ }
}
idx++;
@@ -381,7 +441,7 @@ nsoption_commandline(int *pargc, char **argv)
}
/* exported interface documented in options.h */
-int
+int
nsoption_snoptionf(char *string, size_t size, unsigned int option, const char *fmt)
{
size_t slen = 0; /* current output string length */
@@ -440,6 +500,10 @@ nsoption_snoptionf(char *string, size_t size, unsigned int option, const char *f
slen += nsoption_output_value_text(option_entry,
size, slen, string);
break;
+ case 'I':
+ slen += nsoption_output_value_html_input(option_entry,
+ size, slen, string);
+ break;
}
fmtc++;
} else {
@@ -456,7 +520,7 @@ nsoption_snoptionf(char *string, size_t size, unsigned int option, const char *f
}
/* exported interface documented in options.h */
-void
+void
nsoption_dump(FILE *outf)
{
char buffer[256];
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about.c | 123 ++++++++++++++++++++++++++++------------------
desktop/options.c | 94 +++++++++++++++++++++++++++++------
2 files changed, 154 insertions(+), 63 deletions(-)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 78f22df..81ff2e1 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* about: URL handling.
+/* about: URL handling.
*
- * Based on the data fetcher by Rob Kendrick
+ * Based on the data fetcher by Rob Kendrick
* This fetcher provides a simple scheme for the user to access
* information from the browser from a known, fixed URL.
*/
@@ -198,7 +198,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
msg.data.header_or_data.buf = (const uint8_t *) buffer;
/* page head */
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"<html>\n<head>\n"
"<title>NetSurf Browser Image Cache Status</title>\n"
"<link rel=\"stylesheet\" type=\"text/css\" "
@@ -215,7 +215,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
goto fetch_about_imagecache_handler_aborted;
/* image cache summary */
- slen = image_cache_snsummaryf(buffer, sizeof(buffer),
+ slen = image_cache_snsummaryf(buffer, sizeof(buffer),
"<p>Configured limit of %a hysteresis of %b</p>\n"
"<p>Total bitmap size in use %c (in %d)</p>\n"
"<p>Age %es</p>\n"
@@ -224,7 +224,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
"<p>Cache total/hit/miss/fail (counts) %j/%k/%l/%m "
"(%pj%%/%pk%%/%pl%%/%pm%%)</p>\n"
"<p>Cache total/hit/miss/fail (size) %n/%o/%q/%r "
- "(%pn%%/%po%%/%pq%%/%pr%%)</p>\n"
+ "(%pn%%/%po%%/%pq%%/%pr%%)</p>\n"
"<p>Total images never rendered: %s "
"(includes %t that were converted)</p>\n"
"<p>Total number of excessive conversions: %u "
@@ -232,7 +232,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
"</p>\n"
"<p>Bitmap of size %w had most (%x) conversions</p>\n"
"<h2>Current image cache contents</h2>\n");
- if (slen >= (int) (sizeof(buffer)))
+ if (slen >= (int) (sizeof(buffer)))
goto fetch_about_imagecache_handler_aborted; /* overflow */
msg.data.header_or_data.len = slen;
@@ -241,7 +241,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
/* image cache entry table */
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"<p class=\"imagecachelist\">\n"
"<strong>"
"<span>Entry</span>"
@@ -266,7 +266,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
"<span>%s</span>"
"<span>%o</span>"
"</a>\n");
- if (res <= 0)
+ if (res <= 0)
break; /* last option */
if (res >= (int) (sizeof buffer - slen)) {
@@ -282,7 +282,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
}
} while (res > 0);
- slen += snprintf(buffer + slen, sizeof buffer - slen,
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
"</p>\n</body>\n</html>\n");
msg.data.header_or_data.len = slen;
@@ -307,6 +307,9 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
int slen;
unsigned int opt_loop = 0;
int res = 0;
+ lwc_string *path;
+ url_func_result status;
+
/* content is going to return ok */
fetch_set_http_code(ctx->fetchh, code);
@@ -318,7 +321,8 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
- slen = snprintf(buffer, sizeof buffer,
+#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1
+ slen = snprintf(buffer, sizeof buffer,
"<html>\n<head>\n"
"<title>NetSurf Browser Config</title>\n"
"<link rel=\"stylesheet\" type=\"text/css\" "
@@ -330,14 +334,23 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
"<img src=\"resource:netsurf.png\" alt=\"NetSurf\"></a>"
"</p>\n"
"<h1>NetSurf Browser Config</h1>\n"
+#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
+ "<form action=\"about:config\" method=\"GET\">"
+#endif
"<table class=\"config\">\n"
"<tr><th></th><th></th><th></th></tr>\n");
do {
+#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
+ res = nsoption_snoptionf(buffer + slen, sizeof buffer - slen,
+ opt_loop,
+ "<tr><th>%k</th><td>%t</td><td>%I</td></tr>\n");
+#else
res = nsoption_snoptionf(buffer + slen, sizeof buffer - slen,
opt_loop,
"<tr><th>%k</th><td>%t</td><td>%V</td></tr>\n");
- if (res <= 0)
+#endif
+ if (res <= 0)
break; /* last option */
if (res >= (int) (sizeof buffer - slen)) {
@@ -353,8 +366,22 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
}
} while (res > 0);
- slen += snprintf(buffer + slen, sizeof buffer - slen,
+#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
+ "</table>\n");
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
+ "<br/><center>"
+ "<input type=\"hidden\" name=\"token\" value=\"\" />\n"
+ "<input type=\"submit\" name=\"action\" value=\"Save\" />\n"
+ "<input type=\"submit\" name=\"action\" value=\"Abort\" />\n"
+ "</center><br/>\n"
+ "</form>\n"
"</table>\n</body>\n</html>\n");
+#else
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
+ "</table>\n</body>\n</html>\n");
+#endif
+
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
@@ -371,7 +398,7 @@ fetch_about_config_handler_aborted:
/** Generate the text of a Choices file which represents the current
- * in use options.
+ * in use options.
*/
static bool fetch_about_choices_handler(struct fetch_about_context *ctx)
{
@@ -392,15 +419,15 @@ static bool fetch_about_choices_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"# Automatically generated current NetSurf browser Choices\n");
do {
- res = nsoption_snoptionf(buffer + slen,
- sizeof buffer - slen,
- opt_loop,
+ res = nsoption_snoptionf(buffer + slen,
+ sizeof buffer - slen,
+ opt_loop,
"%k:%v\n");
- if (res <= 0)
+ if (res <= 0)
break; /* last option */
if (res >= (int) (sizeof buffer - slen)) {
@@ -441,7 +468,7 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
int code = 200;
int slen;
int i;
-
+
/* content is going to return ok */
fetch_set_http_code(ctx->fetchh, code);
@@ -453,14 +480,14 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"# Automatically generated by NetSurf build system\n\n");
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
- slen = snprintf(buffer, sizeof buffer,
+
+ slen = snprintf(buffer, sizeof buffer,
#if defined(WT_BRANCHISTRUNK) || defined(WT_BRANCHISMASTER)
"# This is a *DEVELOPMENT* build from the main line.\n\n"
#elif defined(WT_BRANCHISTAG) && (WT_MODIFIED == 0)
@@ -482,29 +509,29 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
#endif
);
- msg.data.header_or_data.len = slen;
+ msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
- slen = snprintf(buffer, sizeof buffer,
+
+ slen = snprintf(buffer, sizeof buffer,
"Built by %s (%s) from %s at revision %s\n\n",
GECOS, USERNAME, WT_BRANCHPATH, WT_REVID);
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
- slen = snprintf(buffer, sizeof buffer,
+
+ slen = snprintf(buffer, sizeof buffer,
"Built on %s in %s\n\n",
WT_HOSTNAME, WT_ROOT);
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
+
if (WT_MODIFIED > 0) {
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"Working tree has %d modification%s\n\n",
WT_MODIFIED, WT_MODIFIED == 1 ? "" : "s");
} else {
@@ -515,7 +542,7 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
+
for (i = 0; i < WT_MODIFIED; ++i) {
slen = snprintf(buffer, sizeof buffer,
" %s %s\n",
@@ -524,10 +551,10 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))
goto fetch_about_testament_handler_aborted;
-
+
}
- msg.type = FETCH_FINISHED;
+ msg.type = FETCH_FINISHED;
fetch_about_send_callback(&msg, ctx);
return true;
@@ -602,15 +629,15 @@ struct about_handlers about_handler_list[] = {
fetch_about_imagecache_handler, true },
/* The default blank page */
{ "blank", SLEN("blank"), NULL,
- fetch_about_blank_handler, true }
+ fetch_about_blank_handler, true }
};
#define about_handler_list_len (sizeof(about_handler_list) / \
sizeof(struct about_handlers))
/**
- * List all the valid about: paths available
- *
+ * List all the valid about: paths available
+ *
* \param ctx The fetch context.
* \return true for sucess or false to generate an error.
*/
@@ -633,7 +660,7 @@ static bool fetch_about_about_handler(struct fetch_about_context *ctx)
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;
- slen = snprintf(buffer, sizeof buffer,
+ slen = snprintf(buffer, sizeof buffer,
"<html>\n<head>\n"
"<title>NetSurf List of About pages</title>\n"
"<link rel=\"stylesheet\" type=\"text/css\" "
@@ -653,11 +680,11 @@ static bool fetch_about_about_handler(struct fetch_about_context *ctx)
if (about_handler_list[abt_loop].hidden)
continue;
- res = snprintf(buffer + slen, sizeof buffer - slen,
- "<li><a href=\"about:%s\">about:%s</a></li>\n",
- about_handler_list[abt_loop].name,
+ res = snprintf(buffer + slen, sizeof buffer - slen,
+ "<li><a href=\"about:%s\">about:%s</a></li>\n",
+ about_handler_list[abt_loop].name,
about_handler_list[abt_loop].name);
- if (res <= 0)
+ if (res <= 0)
break; /* last option */
if (res >= (int)(sizeof buffer - slen)) {
@@ -672,7 +699,7 @@ static bool fetch_about_about_handler(struct fetch_about_context *ctx)
}
}
- slen += snprintf(buffer + slen, sizeof buffer - slen,
+ slen += snprintf(buffer + slen, sizeof buffer - slen,
"</ul>\n</body>\n</html>\n");
msg.data.header_or_data.len = slen;
@@ -696,8 +723,8 @@ static bool fetch_about_initialise(lwc_string *scheme)
lwc_error error;
for (abt_loop = 0; abt_loop < about_handler_list_len; abt_loop++) {
- error = lwc_intern_string(about_handler_list[abt_loop].name,
- about_handler_list[abt_loop].name_len,
+ error = lwc_intern_string(about_handler_list[abt_loop].name,
+ about_handler_list[abt_loop].name_len,
&about_handler_list[abt_loop].lname);
if (error != lwc_error_ok) {
while (abt_loop-- != 0) {
@@ -744,15 +771,15 @@ fetch_about_setup(struct fetch *fetchh,
path = nsurl_get_component(url, NSURL_PATH);
- for (handler_loop = 0;
- handler_loop < about_handler_list_len;
+ for (handler_loop = 0;
+ handler_loop < about_handler_list_len;
handler_loop++) {
ctx->handler = about_handler_list[handler_loop].handler;
- if (lwc_string_isequal(path,
- about_handler_list[handler_loop].lname,
+ if (lwc_string_isequal(path,
+ about_handler_list[handler_loop].lname,
&match) == lwc_error_ok && match) {
break;
- }
+ }
}
if (path != NULL)
diff --git a/desktop/options.c b/desktop/options.c
index 2a080d5..4bdac6d 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -67,7 +67,7 @@ struct option_entry_s option_table[] = {
/**
* Set an option value based on a string
*/
-static bool
+static bool
strtooption(const char *value, struct option_entry_s *option_entry)
{
bool ret = false;
@@ -188,12 +188,12 @@ void nsoption_write(const char *path)
for (entry = 0; entry != option_table_entries; entry++) {
switch (option_table[entry].type) {
case OPTION_BOOL:
- fprintf(fp, "%s:%c\n", option_table[entry].key,
+ fprintf(fp, "%s:%c\n", option_table[entry].key,
*((bool *) option_table[entry].p) ? '1' : '0');
break;
case OPTION_INTEGER:
- fprintf(fp, "%s:%i\n", option_table[entry].key,
+ fprintf(fp, "%s:%i\n", option_table[entry].key,
*((int *) option_table[entry].p));
break;
@@ -204,12 +204,12 @@ void nsoption_write(const char *path)
option_table[entry].p)) << 0) |
((0x00FF0000 & *((colour *)
option_table[entry].p)) >> 16);
- fprintf(fp, "%s:%06x\n", option_table[entry].key,
+ fprintf(fp, "%s:%06x\n", option_table[entry].key,
rgbcolour);
break;
case OPTION_STRING:
- if (((*((char **) option_table[entry].p)) != NULL) &&
+ if (((*((char **) option_table[entry].p)) != NULL) &&
(*(*((char **) option_table[entry].p)) != 0)) {
fprintf(fp, "%s:%s\n", option_table[entry].key,
*((char **) option_table[entry].p));
@@ -231,7 +231,7 @@ void nsoption_write(const char *path)
* \param string The string in which to output the value.
* \return The number of bytes written to string or -1 on error
*/
-static size_t
+static size_t
nsoption_output_value_html(struct option_entry_s *option,
size_t size, size_t pos, char *string)
{
@@ -274,6 +274,66 @@ nsoption_output_value_html(struct option_entry_s *option,
return slen;
}
+/**
+ * Output an option value into a string, in HTML form element format.
+ *
+ * \param option The option to output the value of.
+ * \param size The size of the string buffer.
+ * \param pos The current position in string
+ * \param string The string in which to output the value.
+ * \return The number of bytes written to string or -1 on error
+ */
+static size_t
+nsoption_output_value_html_input(struct option_entry_s *option,
+ size_t size, size_t pos, char *string)
+{
+ size_t slen = 0; /* length added to string */
+ colour rgbcolour; /* RRGGBB */
+ char hexcolour[7];
+
+ switch (option->type) {
+ case OPTION_BOOL:
+ slen = snprintf(string + pos, size - pos,
+ "<select name=\"%s\">"
+ "<option value=1 %s>Enabled"
+ "<option value=0 %s>Disabled"
+ "</select>",
+ option->key,
+ *((bool *)option->p) ? "selected" : "",
+ *((bool *)option->p) ? "" : "selected");
+ break;
+
+ case OPTION_INTEGER:
+ slen = snprintf(string + pos, size - pos,
+ "<input type=\"text\" name=\"%s\" value=\"%i\"/>",
+ option->key, *((int *)option->p));
+ break;
+
+ case OPTION_COLOUR:
+ rgbcolour = ((0x000000FF & *((colour *) option->p)) << 16) |
+ ((0x0000FF00 & *((colour *) option->p)) << 0) |
+ ((0x00FF0000 & *((colour *) option->p)) >> 16);
+ slen = snprintf(string + pos, size - pos,
+ "<input type=\"text\" name=\"%s\" value=\"%06x\"/> "
+ "<span style=\"background-color: #%06x; color: #%06x; \">"
+ " </span>",
+ option->key, rgbcolour,
+ rgbcolour, (~rgbcolour) & 0xffffff);
+ break;
+
+ case OPTION_STRING:
+ slen = snprintf(string + pos, size - pos,
+ "<input type=\"text\" name=\"%s\" value=\"%s\"/>",
+ option->key,
+ (*((char **)option->p) != NULL) ?
+ *((char **)option->p) :
+ "NULL");
+ break;
+ }
+
+ return slen;
+}
+
/**
* Output an option value into a string, in plain text format.
@@ -284,7 +344,7 @@ nsoption_output_value_html(struct option_entry_s *option,
* \param string The string in which to output the value.
* \return The number of bytes written to string or -1 on error
*/
-static size_t
+static size_t
nsoption_output_value_text(struct option_entry_s *option,
size_t size, size_t pos, char *string)
{
@@ -321,7 +381,7 @@ nsoption_output_value_text(struct option_entry_s *option,
}
/* exported interface documented in options.h */
-void
+void
nsoption_commandline(int *pargc, char **argv)
{
char *arg;
@@ -360,14 +420,14 @@ nsoption_commandline(int *pargc, char **argv)
LOG(("%.*s = %s",arglen,arg,val));
- for (entry_loop = 0;
- entry_loop < option_table_entries;
+ for (entry_loop = 0;
+ entry_loop < option_table_entries;
entry_loop++) {
- if (strncmp(arg, option_table[entry_loop].key,
- arglen) == 0) {
+ if (strncmp(arg, option_table[entry_loop].key,
+ arglen) == 0) {
strtooption(val, option_table + entry_loop);
break;
- }
+ }
}
idx++;
@@ -381,7 +441,7 @@ nsoption_commandline(int *pargc, char **argv)
}
/* exported interface documented in options.h */
-int
+int
nsoption_snoptionf(char *string, size_t size, unsigned int option, const char *fmt)
{
size_t slen = 0; /* current output string length */
@@ -440,6 +500,10 @@ nsoption_snoptionf(char *string, size_t size, unsigned int option, const char *f
slen += nsoption_output_value_text(option_entry,
size, slen, string);
break;
+ case 'I':
+ slen += nsoption_output_value_html_input(option_entry,
+ size, slen, string);
+ break;
}
fmtc++;
} else {
@@ -456,7 +520,7 @@ nsoption_snoptionf(char *string, size_t size, unsigned int option, const char *f
}
/* exported interface documented in options.h */
-void
+void
nsoption_dump(FILE *outf)
{
char buffer[256];
--
NetSurf Browser
10 years, 11 months