Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/e4d6d9a972736bbea70eb0af62a430e77cc05ee5
...commit
http://git.netsurf-browser.org/netsurf.git/commit/e4d6d9a972736bbea70eb0af62a430e77cc05ee5
...tree
http://git.netsurf-browser.org/netsurf.git/tree/e4d6d9a972736bbea70eb0af62a430e77cc05ee5
The branch, chris/menuclass has been updated
via e4d6d9a972736bbea70eb0af62a430e77cc05ee5 (commit)
via 313aaabdde2e6f0bb1f0dfe571b77261cc697a95 (commit)
via 9f10babe645fe67b02fae90f852d5e4cdfcbb70e (commit)
via 7dab7cb43d4091648ceb40684ff70aff7091c648 (commit)
via 8ffc2e753b04a9e794e7a6302d57d590b311e41f (commit)
via 74e73a3b8b5ab3effd8e3d94c10463907d4c4ea9 (commit)
via 9e037376276aaa042b529499f1978766b9535f7b (commit)
from 0d9023148d2a34bd908aac38e44d449359b03438 (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/commit/?id=e4d6d9a972736bbea70eb0af62a430e77cc05ee5
commit e4d6d9a972736bbea70eb0af62a430e77cc05ee5
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Get selected state with MenuClass compatible abstraction
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 3d2f293..175fe15 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -111,6 +111,25 @@ const char * const verdate;
static nserror ami_menu_scan(struct ami_menu_data **md);
void ami_menu_arexx_scan(struct ami_menu_data **md);
+static bool ami_menu_get_selected(struct Menu *menu, struct IntuiMessage *msg)
+{
+ bool checked = false;
+
+ if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
+#ifdef __amigaos4__
+ ULONG state;
+ struct ExtIntuiMessage *emsg = (struct ExtIntuiMessage *)msg;
+
+ state = IDoMethod(menu, MM_GETSTATE, 0, emsg->eim_LongCode,
MS_CHECKED);
+ if(state & MS_CHECKED) checked = true;
+#endif
+ } else {
+ if(ItemAddress(menu, msg->Code)->Flags & CHECKED) checked =
true;
+ }
+
+ return checked;
+}
+
void ami_menu_set_check_toggled(void)
{
ami_menu_check_toggled = true;
@@ -378,8 +397,8 @@ HOOKF(void, ami_menu_item_browser_foreimg, APTR, window,
struct IntuiMessage *)
bool checked = false;
GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
- if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
-
+ checked = ami_menu_get_selected(menustrip, msg);
+
nsoption_set_bool(foreground_images, checked);
ami_menu_set_check_toggled();
}
@@ -390,7 +409,7 @@ HOOKF(void, ami_menu_item_browser_backimg, APTR, window,
struct IntuiMessage *)
bool checked = false;
GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
- if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
+ checked = ami_menu_get_selected(menustrip, msg);
nsoption_set_bool(background_images, checked);
ami_menu_set_check_toggled();
@@ -402,7 +421,7 @@ HOOKF(void, ami_menu_item_browser_enablejs, APTR, window,
struct IntuiMessage *)
bool checked = false;
GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
- if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
+ checked = ami_menu_get_selected(menustrip, msg);
nsoption_set_bool(enable_javascript, checked);
ami_menu_set_check_toggled();
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=313aaabdde2e6f0bb1f0dfe571b77261cc697a95
commit 313aaabdde2e6f0bb1f0dfe571b77261cc697a95
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Replace OnMenu/OffMenu with MenuClass compatible abstraction
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 9489110..0fc9841 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -89,11 +89,11 @@ void gui_start_selection(struct gui_window *g)
if(!g->shared->win) return;
if(nsoption_bool(kiosk_mode) == true) return;
- OnMenu(g->shared->win, AMI_MENU_CLEAR);
- OnMenu(g->shared->win, AMI_MENU_COPY);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu, M_COPY, false);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu, M_CLEAR, false);
if (browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_CUT)
- OnMenu(g->shared->win, AMI_MENU_CUT);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu, M_CUT,
false);
}
static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG
codeset, size_t *text_length)
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 6627e87..cb0f2fa 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1206,16 +1206,12 @@ static void ami_update_buttons(struct gui_window_2
*gwin)
if(!browser_window_reload_available(gwin->gw->bw))
reload=TRUE;
- if(nsoption_bool(kiosk_mode) == false)
- {
- if(gwin->tabs <= 1)
- {
+ if(nsoption_bool(kiosk_mode) == false) {
+ if(gwin->tabs <= 1) {
tabclose=TRUE;
- OffMenu(gwin->win,AMI_MENU_CLOSETAB);
- }
- else
- {
- OnMenu(gwin->win,AMI_MENU_CLOSETAB);
+ ami_menu_set_disabled(gwin->win, gwin->imenu,
M_CLOSETAB, true);
+ } else {
+ ami_menu_set_disabled(gwin->win, gwin->imenu,
M_CLOSETAB, false);
}
}
@@ -5262,7 +5258,7 @@ static void gui_window_place_caret(struct gui_window *g,
int x, int y, int heigh
g->c_h = height;
if((nsoption_bool(kiosk_mode) == false))
- OnMenu(g->shared->win, AMI_MENU_PASTE);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu,
M_PASTE, false);
}
static void gui_window_remove_caret(struct gui_window *g)
@@ -5271,7 +5267,7 @@ static void gui_window_remove_caret(struct gui_window *g)
if(g->c_h == 0) return;
if((nsoption_bool(kiosk_mode) == false))
- OffMenu(g->shared->win, AMI_MENU_PASTE);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu,
M_PASTE, true);
ami_do_redraw_limits(g, g->bw, false, g->c_x, g->c_y,
g->c_x + g->c_w + 1, g->c_y + g->c_h + 1);
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 3595f96..3d2f293 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -1175,6 +1175,120 @@ static nserror ami_menu_scan(struct ami_menu_data **md)
return ami_hotlist_scan((void *)md, AMI_MENU_HOTLIST,
messages_get("HotlistMenu"), ami_menu_hotlist_add);
}
+#ifdef __amigaos4__
+void ami_menu_set_disabled_mc(struct Window *win, struct Menu *menu, int item,
bool disable)
+{
+ ULONG disable_state = MS_DISABLED;
+
+ if(disable == false) {
+ disable_state = 0;
+ }
+
+ IDoMethod(menu, MM_SETSTATE, 0, item, MS_DISABLED, disable_state);
+}
+#endif
+
+static ULONG ami_menu_number(int item)
+{
+ /* horrible, horrible, horrible */
+ ULONG menu_num;
+
+ switch(item) {
+ case M_SAVETXT:
+ menu_num = FULLMENUNUM(0,4,1);
+ break;
+
+ case M_SAVECOMP:
+ menu_num = FULLMENUNUM(0,4,2);
+ break;
+
+ case M_SAVEIFF:
+ menu_num = FULLMENUNUM(0,4,3);
+ break;
+#ifdef WITH_PDF_EXPORT:
+ case M_SAVEPDF:
+ menu_num = FULLMENUNUM(0,4,4);
+ break;
+#endif
+ case M_CLOSETAB:
+ menu_num = FULLMENUNUM(0,8,0);
+ break;
+
+ case M_CUT:
+ menu_num = FULLMENUNUM(1,0,0);
+ break;
+
+ case M_COPY:
+ menu_num = FULLMENUNUM(1,1,0);
+ break;
+
+ case M_PASTE:
+ menu_num = FULLMENUNUM(1,2,0);
+ break;
+
+ case M_SELALL:
+ menu_num = FULLMENUNUM(1,4,0);
+ break;
+
+ case M_CLEAR:
+ menu_num = FULLMENUNUM(1,5,0);
+ break;
+
+ case M_UNDO:
+ menu_num = FULLMENUNUM(1,8,0);
+ break;
+
+ case M_REDO:
+ menu_num = FULLMENUNUM(1,9,0);
+ break;
+
+ case M_FIND:
+ menu_num = FULLMENUNUM(2,0,0);
+ break;
+
+ case M_IMGFORE:
+ menu_num = FULLMENUNUM(2,8,0);
+ break;
+
+ case M_IMGBACK:
+ menu_num = FULLMENUNUM(2,8,1);
+ break;
+
+ case M_JS:
+ menu_num = FULLMENUNUM(2,9,0);
+ break;
+
+ default:
+ LOG("WARNING: Unrecognised menu item %d", item);
+ menu_num = 0;
+ break;
+ }
+
+ return menu_num;
+}
+
+static void ami_menu_set_disabled_gt(struct Window *win, struct Menu *menu,
int item, bool disable)
+{
+ ULONG menu_num = ami_menu_number(item);
+
+ if(disable == false) {
+ OnMenu(win, menu_num);
+ } else {
+ OffMenu(win, menu_num);
+ }
+}
+
+void ami_menu_set_disabled(struct Window *win, struct Menu *menu, int item,
bool disable)
+{
+ if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
+#ifdef __amigaos4__
+ return ami_menu_set_disabled_mc(win, menu, item, disable);
+#endif
+ } else {
+ return ami_menu_set_disabled_gt(win, menu, item, disable);
+ }
+}
+
void ami_menu_update_checked(struct gui_window_2 *gwin)
{
if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
@@ -1187,26 +1301,26 @@ void ami_menu_update_checked(struct gui_window_2 *gwin)
GetAttr(WINDOW_MenuStrip, gwin->objects[OID_MAIN], (ULONG *)&menustrip);
if(!menustrip) return;
if(nsoption_bool(enable_javascript) == true) {
- if((ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED) == 0)
- ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED;
+ if((ItemAddress(menustrip, ami_menu_number(M_JS))->Flags &
CHECKED) == 0)
+ ItemAddress(menustrip, ami_menu_number(M_JS))->Flags ^=
CHECKED;
} else {
- if(ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED)
- ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED;
+ if(ItemAddress(menustrip, ami_menu_number(M_JS))->Flags &
CHECKED)
+ ItemAddress(menustrip, ami_menu_number(M_JS))->Flags ^=
CHECKED;
}
if(nsoption_bool(foreground_images) == true) {
- if((ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED)
== 0)
- ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^=
CHECKED;
+ if((ItemAddress(menustrip, ami_menu_number(M_IMGFORE))->Flags &
CHECKED) == 0)
+ ItemAddress(menustrip,
ami_menu_number(M_IMGFORE))->Flags ^= CHECKED;
} else {
- if(ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED)
- ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^=
CHECKED;
+ if(ItemAddress(menustrip, ami_menu_number(M_IMGFORE))->Flags &
CHECKED)
+ ItemAddress(menustrip,
ami_menu_number(M_IMGFORE))->Flags ^= CHECKED;
}
if(nsoption_bool(background_images) == true) {
- if((ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags & CHECKED)
== 0)
- ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags ^=
CHECKED;
+ if((ItemAddress(menustrip, ami_menu_number(M_IMGBACK))->Flags &
CHECKED) == 0)
+ ItemAddress(menustrip,
ami_menu_number(M_IMGBACK))->Flags ^= CHECKED;
} else {
- if(ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags & CHECKED)
- ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags ^=
CHECKED;
+ if(ItemAddress(menustrip, ami_menu_number(M_IMGBACK))->Flags &
CHECKED)
+ ItemAddress(menustrip,
ami_menu_number(M_IMGBACK))->Flags ^= CHECKED;
}
ResetMenuStrip(gwin->win, menustrip);
@@ -1220,10 +1334,10 @@ void ami_menu_update_disabled(struct gui_window *g,
struct hlcache_handle *c)
if(content_get_type(c) <= CONTENT_CSS)
{
- OnMenu(win,AMI_MENU_SAVEAS_TEXT);
- OnMenu(win,AMI_MENU_SAVEAS_COMPLETE);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVETXT, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVECOMP, false);
#ifdef WITH_PDF_EXPORT
- OnMenu(win,AMI_MENU_SAVEAS_PDF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEPDF, false);
#endif
#if 0
if(browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_COPY)
{
@@ -1244,28 +1358,29 @@ void ami_menu_update_disabled(struct gui_window *g,
struct hlcache_handle *c)
else
OffMenu(win,AMI_MENU_PASTE);
#else
- OnMenu(win,AMI_MENU_CUT);
- OnMenu(win,AMI_MENU_COPY);
- OnMenu(win,AMI_MENU_PASTE);
- OnMenu(win,AMI_MENU_CLEAR);
+ ami_menu_set_disabled(win, g->shared->imenu, M_CUT, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_COPY, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_PASTE, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_CLEAR, false);
#endif
- OnMenu(win,AMI_MENU_SELECTALL);
- OnMenu(win,AMI_MENU_FIND);
- OffMenu(win,AMI_MENU_SAVEAS_IFF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SELALL, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_FIND, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEIFF, true);
}
else
{
- OffMenu(win,AMI_MENU_CUT);
- OffMenu(win,AMI_MENU_PASTE);
- OffMenu(win,AMI_MENU_CLEAR);
+ ami_menu_set_disabled(win, g->shared->imenu, M_CUT, true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_PASTE, true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_CLEAR, true);
- OffMenu(win,AMI_MENU_SAVEAS_TEXT);
- OffMenu(win,AMI_MENU_SAVEAS_COMPLETE);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVETXT, true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVECOMP, true);
#ifdef WITH_PDF_EXPORT
- OffMenu(win,AMI_MENU_SAVEAS_PDF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEPDF, true);
#endif
- OffMenu(win,AMI_MENU_SELECTALL);
- OffMenu(win,AMI_MENU_FIND);
+
+ ami_menu_set_disabled(win, g->shared->imenu, M_SELALL, true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_FIND, true);
#ifdef WITH_NS_SVG
if(content_get_bitmap(c) || (ami_mime_compare(c, "svg") ==
true))
@@ -1273,13 +1388,13 @@ void ami_menu_update_disabled(struct gui_window *g,
struct hlcache_handle *c)
if(content_get_bitmap(c))
#endif
{
- OnMenu(win,AMI_MENU_COPY);
- OnMenu(win,AMI_MENU_SAVEAS_IFF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_COPY,
false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEIFF,
false);
}
else
{
- OffMenu(win,AMI_MENU_COPY);
- OffMenu(win,AMI_MENU_SAVEAS_IFF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_COPY,
true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEIFF,
true);
}
}
}
diff --git a/frontends/amiga/menu.h b/frontends/amiga/menu.h
index ad0e96d..43f7e1e 100644
--- a/frontends/amiga/menu.h
+++ b/frontends/amiga/menu.h
@@ -115,24 +115,6 @@ enum {
* only used for freeing the UTF-8 converted menu labels */
#define AMI_MENU_MAX AMI_MENU_AREXX
-/* The Intuition menu numbers of some menus we might need to modify */
-#define AMI_MENU_SAVEAS_TEXT FULLMENUNUM(0,4,1)
-#define AMI_MENU_SAVEAS_COMPLETE FULLMENUNUM(0,4,2)
-#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,3)
-#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,4)
-#define AMI_MENU_CLOSETAB FULLMENUNUM(0,8,0)
-#define AMI_MENU_CUT FULLMENUNUM(1,0,0)
-#define AMI_MENU_COPY FULLMENUNUM(1,1,0)
-#define AMI_MENU_PASTE FULLMENUNUM(1,2,0)
-#define AMI_MENU_SELECTALL FULLMENUNUM(1,4,0)
-#define AMI_MENU_CLEAR FULLMENUNUM(1,5,0)
-#define AMI_MENU_UNDO FULLMENUNUM(1,8,0)
-#define AMI_MENU_REDO FULLMENUNUM(1,9,0)
-#define AMI_MENU_FIND FULLMENUNUM(2,0,0)
-#define AMI_MENU_FOREIMG FULLMENUNUM(2,8,0)
-#define AMI_MENU_BACKIMG FULLMENUNUM(2,8,1)
-#define AMI_MENU_JS FULLMENUNUM(2,9,0)
-
struct gui_window;
struct gui_window_2;
@@ -155,6 +137,11 @@ void ami_menu_update_disabled(struct gui_window *g, struct
hlcache_handle *c);
void ami_menu_free(struct gui_window_2 *gwin);
/**
+ * Set disabled state of a menu item
+ */
+void ami_menu_set_disabled(struct Window *win, struct Menu *menu, int item,
bool disable);
+
+/**
* Sets that an item linked to a toggle menu item has been changed.
*/
void ami_menu_set_check_toggled(void);
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=9f10babe645fe67b02fae90f852d5e4cdfcbb70e
commit 9f10babe645fe67b02fae90f852d5e4cdfcbb70e
Merge: 0d90231 7dab7cb
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Merge branch 'master' of git://git.netsurf-browser.org/netsurf into
chris/menuclass
-----------------------------------------------------------------------
Summary of changes:
Docs/core-window-interface | 2 +-
content/handlers/css/select.c | 1 +
desktop/browser_history.c | 126 +++++++++---
desktop/browser_private.h | 3 +-
desktop/font_haru.h | 1 -
desktop/knockout.c | 2 +-
desktop/options.h | 2 +-
desktop/plot_style.c | 15 +-
desktop/scrollbar.c | 6 +-
desktop/system_colour.h | 2 +-
desktop/textarea.h | 3 +-
frontends/amiga/clipboard.c | 6 +-
frontends/amiga/corewindow.c | 2 +-
frontends/amiga/gui.c | 18 +-
frontends/amiga/menu.c | 212 ++++++++++++++++----
frontends/amiga/menu.h | 23 +--
frontends/atari/plot/font_freetype.c | 2 +-
frontends/atari/plot/font_internal.c | 2 +-
frontends/atari/plot/fontplot.c | 2 +-
frontends/atari/settings.c | 2 +-
frontends/atari/toolbar.c | 1 -
frontends/beos/font.h | 2 +-
frontends/cocoa/font.h | 2 +-
frontends/cocoa/plotter.h | 2 +-
frontends/cocoa/plotter.m | 1 -
frontends/framebuffer/convert_image.c | 2 +-
frontends/framebuffer/fbtk.h | 2 +-
frontends/framebuffer/fbtk/user.c | 1 -
frontends/framebuffer/font_freetype.c | 1 +
frontends/framebuffer/font_internal.c | 1 +
frontends/gtk/corewindow.c | 2 +-
frontends/gtk/layout_pango.c | 1 +
frontends/monkey/layout.c | 2 +-
frontends/riscos/configure/con_fonts.c | 2 +-
frontends/riscos/font.c | 1 +
frontends/riscos/font.h | 5 +-
frontends/riscos/image.h | 2 +-
frontends/riscos/templates/de | 2 +-
frontends/riscos/templates/en | 2 +-
frontends/riscos/templates/fr | 2 +-
frontends/riscos/templates/nl | 2 +-
frontends/windows/corewindow.c | 1 -
frontends/windows/font.c | 1 +
frontends/windows/font.h | 4 +-
include/netsurf/clipboard.h | 2 +-
include/netsurf/content.h | 2 +-
{desktop => include/netsurf}/plot_style.h | 166 +++++++--------
include/netsurf/plotters.h | 2 +-
.../windows/file.h => include/netsurf/types.h | 20 +-
render/box_construct.c | 5 +-
render/font.c | 1 +
render/font.h | 4 +-
render/form.c | 9 +-
render/html.h | 5 +-
utils/nsoption.c | 2 +-
55 files changed, 436 insertions(+), 258 deletions(-)
rename {desktop => include/netsurf}/plot_style.h (88%)
copy frontends/windows/file.h => include/netsurf/types.h (71%)
diff --git a/Docs/core-window-interface b/Docs/core-window-interface
index 0267f37..3dfbcaf 100644
--- a/Docs/core-window-interface
+++ b/Docs/core-window-interface
@@ -259,7 +259,7 @@ frontends/example/corewindow.c
#include "utils/utf8.h"
#include "netsurf/keypress.h"
#include "netsurf/mouse.h"
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
/* extremely likely there will be additional headers required in a real
frontend */
#include "example/corewindow.h"
diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c
index aaede77..daa3b40 100644
--- a/content/handlers/css/select.c
+++ b/content/handlers/css/select.c
@@ -24,6 +24,7 @@
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/nsurl.h"
+#include "netsurf/plot_style.h"
#include "netsurf/url_db.h"
#include "desktop/system_colour.h"
diff --git a/desktop/browser_history.c b/desktop/browser_history.c
index 5cd98cd..d21c5bc 100644
--- a/desktop/browser_history.c
+++ b/desktop/browser_history.c
@@ -37,6 +37,7 @@
#include "content/urldb.h"
#include "netsurf/bitmap.h"
+#include "desktop/system_colour.h"
#include "desktop/gui_internal.h"
#include "desktop/browser_history.h"
#include "desktop/browser_private.h"
@@ -235,6 +236,45 @@ static void browser_window_history__layout(struct history
*history)
history->height += BOTTOM_MARGIN / 2;
}
+/** plot style for drawing lines between nodes */
+static plot_style_t pstyle_line = {
+ .stroke_type = PLOT_OP_TYPE_SOLID,
+ .stroke_width = 2,
+};
+
+/** plot style for drawing background */
+static plot_style_t pstyle_bg = {
+ .fill_type = PLOT_OP_TYPE_SOLID,
+};
+
+/** plot style for drawing rectangle round unselected nodes */
+static plot_style_t pstyle_rect = {
+ .stroke_type = PLOT_OP_TYPE_SOLID,
+ .stroke_width = 1,
+};
+
+/** plot style for drawing rectangle round selected nodes */
+static plot_style_t pstyle_rect_sel = {
+ .stroke_type = PLOT_OP_TYPE_SOLID,
+ .stroke_width = 3,
+};
+
+/** plot style for font on unselected nodes */
+static plot_font_style_t pfstyle_node = {
+ .family = PLOT_FONT_FAMILY_SANS_SERIF,
+ .size = 8 * FONT_SIZE_SCALE,
+ .weight = 400,
+ .flags = FONTF_NONE,
+};
+
+/** plot style for font on unselected nodes */
+static plot_font_style_t pfstyle_node_sel = {
+ .family = PLOT_FONT_FAMILY_SANS_SERIF,
+ .size = 8 * FONT_SIZE_SCALE,
+ .weight = 900,
+ .flags = FONTF_NONE,
+};
+
/**
* Recursively redraw a history_entry.
*
@@ -260,19 +300,25 @@ browser_window_history__redraw_entry(struct history
*history,
size_t char_offset;
int actual_x;
struct history_entry *child;
- colour c = entry == history->current ?
- HISTORY_COLOUR_SELECTED : HISTORY_COLOUR_FOREGROUND;
int tailsize = 5;
int xoffset = x - x0;
int yoffset = y - y0;
- plot_style_t pstyle_history_rect = {
- .stroke_type = PLOT_OP_TYPE_SOLID,
- .stroke_colour = c,
- .stroke_width = entry == history->current ? 3 : 1,
- };
- plot_font_style_t fstyle = *plot_style_font;
+
+ plot_style_t *pstyle;
+ plot_font_style_t *pfstyle;
+
nserror res;
+ /* setup plot styles */
+ if (entry == history->current) {
+ pstyle = &pstyle_rect_sel;
+ pfstyle = &pfstyle_node_sel;
+ } else {
+ pstyle = &pstyle_rect;
+ pfstyle = &pfstyle_node;
+ }
+
+ /* setup clip area */
if (clip) {
struct rect rect;
rect.x0 = x0 + xoffset;
@@ -289,14 +335,16 @@ browser_window_history__redraw_entry(struct history
*history,
plot->bitmap(entry->x + xoffset,
entry->y + yoffset,
WIDTH, HEIGHT,
- entry->bitmap, 0xffffff, 0);
+ entry->bitmap,
+ 0xffffff,
+ 0);
}
if (!plot->rectangle(entry->x - 1 + xoffset,
- entry->y - 1 + yoffset,
- entry->x + xoffset + WIDTH,
- entry->y + yoffset + HEIGHT,
- &pstyle_history_rect)) {
+ entry->y - 1 + yoffset,
+ entry->x + xoffset + WIDTH,
+ entry->y + yoffset + HEIGHT,
+ pstyle)) {
return false;
}
@@ -307,36 +355,42 @@ browser_window_history__redraw_entry(struct history
*history,
return false;
}
- fstyle.background = HISTORY_COLOUR_BACKGROUND;
- fstyle.foreground = c;
- fstyle.weight = entry == history->current ? 900 : 400;
- if (!plot->text(entry->x + xoffset, entry->y + HEIGHT + 12 + yoffset,
- entry->page.title, char_offset, &fstyle))
+ if (!plot->text(entry->x + xoffset,
+ entry->y + HEIGHT + 12 + yoffset,
+ entry->page.title,
+ char_offset,
+ pfstyle)) {
return false;
+ }
+ /* for each child node draw a line and recurse redraw into it */
for (child = entry->forward; child; child = child->next) {
if (!plot->line(entry->x + WIDTH + xoffset,
entry->y + HEIGHT / 2 + yoffset,
- entry->x + WIDTH + tailsize + xoffset,
- entry->y + HEIGHT / 2 + yoffset,
- plot_style_stroke_history))
+ entry->x + WIDTH + tailsize + xoffset,
+ entry->y + HEIGHT / 2 + yoffset,
+ &pstyle_line)) {
return false;
+ }
if (!plot->line(entry->x + WIDTH + tailsize + xoffset,
- entry->y + HEIGHT / 2 + yoffset,
- child->x - tailsize +xoffset,
- child->y + HEIGHT / 2 + yoffset,
- plot_style_stroke_history))
+ entry->y + HEIGHT / 2 + yoffset,
+ child->x - tailsize +xoffset,
+ child->y + HEIGHT / 2 + yoffset,
+ &pstyle_line)) {
return false;
+ }
if (!plot->line(child->x - tailsize + xoffset,
- child->y + HEIGHT / 2 + yoffset,
- child->x + xoffset, child->y +
+ child->y + HEIGHT / 2 + yoffset,
+ child->x + xoffset, child->y +
HEIGHT / 2 + yoffset,
- plot_style_stroke_history))
+ &pstyle_line)) {
return false;
+ }
if (!browser_window_history__redraw_entry(history, child,
- x0, y0, x1, y1, x, y, clip, ctx))
+ x0, y0, x1, y1, x, y, clip, ctx)) {
return false;
+ }
}
return true;
@@ -415,6 +469,17 @@ nserror browser_window_history_create(struct
browser_window *bw)
{
struct history *history;
+ pstyle_bg.fill_colour = ns_system_colour_char("Window");
+ pfstyle_node.background = pstyle_bg.fill_colour;
+ pfstyle_node_sel.background = pstyle_bg.fill_colour;
+
+ pstyle_line.stroke_colour = ns_system_colour_char("GrayText");
+ pstyle_rect.stroke_colour = pstyle_line.stroke_colour;
+ pfstyle_node.foreground = pstyle_line.stroke_colour;
+
+ pstyle_rect_sel.stroke_colour = ns_system_colour_char("Highlight");
+ pfstyle_node_sel.foreground = pstyle_rect_sel.stroke_colour;
+
bw->history = NULL;
history = calloc(1, sizeof *history);
@@ -426,6 +491,7 @@ nserror browser_window_history_create(struct browser_window
*bw)
history->height = BOTTOM_MARGIN / 2;
bw->history = history;
+
return NSERROR_OK;
}
@@ -709,6 +775,7 @@ bool browser_window_history_redraw(struct browser_window
*bw,
if (!history->start)
return true;
+
return browser_window_history__redraw_entry(history, history->start,
0, 0, 0, 0, 0, 0, false, ctx);
}
@@ -726,6 +793,7 @@ bool browser_window_history_redraw_rectangle(struct
browser_window *bw,
if (!history->start)
return true;
+
return browser_window_history__redraw_entry(history, history->start,
x0, y0, x1, y1, x, y, true, ctx);
}
diff --git a/desktop/browser_private.h b/desktop/browser_private.h
index 64c698b..072a894 100644
--- a/desktop/browser_private.h
+++ b/desktop/browser_private.h
@@ -26,9 +26,10 @@
#include <libwapcaplet/libwapcaplet.h>
+#include "netsurf/types.h"
#include "netsurf/browser_window.h"
+
#include "desktop/frame_types.h"
-#include "desktop/plot_style.h"
struct box;
struct hlcache_handle;
diff --git a/desktop/font_haru.h b/desktop/font_haru.h
index 479f7de..988b9ba 100644
--- a/desktop/font_haru.h
+++ b/desktop/font_haru.h
@@ -26,7 +26,6 @@
#include <hpdf.h>
-#include "desktop/plot_style.h"
#include "desktop/font.h"
bool haru_nsfont_apply_style(const plot_font_style_t *fstyle,
diff --git a/desktop/knockout.c b/desktop/knockout.c
index b930ef6..bcfc272 100644
--- a/desktop/knockout.c
+++ b/desktop/knockout.c
@@ -71,10 +71,10 @@
#include "utils/errors.h"
#include "netsurf/bitmap.h"
#include "content/content.h"
+#include "netsurf/plotters.h"
#include "desktop/gui_internal.h"
#include "desktop/knockout.h"
-#include "netsurf/plotters.h"
/* Define to enable knockout debug */
#undef KNOCKOUT_DEBUG
diff --git a/desktop/options.h b/desktop/options.h
index 437d104..d91898c 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -30,7 +30,7 @@
#ifndef _NETSURF_DESKTOP_OPTIONS_H_
#define _NETSURF_DESKTOP_OPTIONS_H_
-#include "desktop/plot_style.h"
+#include "netsurf/types.h"
/* defines for system colour table */
#define NSOPTION_SYS_COLOUR_START NSOPTION_sys_colour_ActiveBorder
diff --git a/desktop/plot_style.c b/desktop/plot_style.c
index f9ba4bc..1f0ac39 100644
--- a/desktop/plot_style.c
+++ b/desktop/plot_style.c
@@ -16,14 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * \file desktop/plot_style.c
+/**
+ * \file
* \brief Plotter global styles.
*
* These plot styles are globaly available and used in many places.
*/
-#include "netsurf/plotters.h"
+#include "netsurf/plot_style.h"
static plot_style_t plot_style_fill_white_static = {
.fill_type = PLOT_OP_TYPE_SOLID,
@@ -152,15 +152,6 @@ static plot_style_t plot_style_stroke_lightwbasec_static =
{
};
plot_style_t *plot_style_stroke_lightwbasec =
&plot_style_stroke_lightwbasec_static;
-/* history styles */
-
-/** stroke style for history core. */
-static plot_style_t plot_style_stroke_history_static = {
- .stroke_type = PLOT_OP_TYPE_SOLID,
- .stroke_colour = HISTORY_COLOUR_LINES,
- .stroke_width = 2,
-};
-plot_style_t *plot_style_stroke_history = &plot_style_stroke_history_static;
/* Generic font style */
static const plot_font_style_t plot_style_font_static = {
diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c
index b9e963a..9a4d70f 100644
--- a/desktop/scrollbar.c
+++ b/desktop/scrollbar.c
@@ -29,14 +29,12 @@
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
-
#include "netsurf/browser_window.h"
-#include "desktop/system_colour.h"
#include "netsurf/mouse.h"
-#include "desktop/scrollbar.h"
#include "netsurf/plotters.h"
-#include "desktop/plot_style.h"
+#include "desktop/system_colour.h"
+#include "desktop/scrollbar.h"
struct scrollbar {
bool horizontal; /* Horizontal scrollbar if true, else vertical
diff --git a/desktop/system_colour.h b/desktop/system_colour.h
index b5d4baa..8e82818 100644
--- a/desktop/system_colour.h
+++ b/desktop/system_colour.h
@@ -26,7 +26,7 @@
#include <libcss/libcss.h>
#include "utils/errors.h"
-#include "desktop/plot_style.h"
+#include "netsurf/types.h"
/** css callback to obtain named system colours. */
css_error ns_system_colour(void *pw, lwc_string *name, css_color *color);
diff --git a/desktop/textarea.h b/desktop/textarea.h
index 74652f3..19162ff 100644
--- a/desktop/textarea.h
+++ b/desktop/textarea.h
@@ -28,8 +28,7 @@
#include <stdbool.h>
#include "utils/utils.h"
-
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
#include "netsurf/mouse.h"
struct textarea;
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 9489110..0fc9841 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -89,11 +89,11 @@ void gui_start_selection(struct gui_window *g)
if(!g->shared->win) return;
if(nsoption_bool(kiosk_mode) == true) return;
- OnMenu(g->shared->win, AMI_MENU_CLEAR);
- OnMenu(g->shared->win, AMI_MENU_COPY);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu, M_COPY, false);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu, M_CLEAR, false);
if (browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_CUT)
- OnMenu(g->shared->win, AMI_MENU_CUT);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu, M_CUT,
false);
}
static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG
codeset, size_t *text_length)
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index d2bfbf9..0ed16d1 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -44,7 +44,7 @@
#include "utils/utf8.h"
#include "netsurf/keypress.h"
#include "netsurf/mouse.h"
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
#include <proto/exec.h>
#include <proto/intuition.h>
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 6627e87..cb0f2fa 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1206,16 +1206,12 @@ static void ami_update_buttons(struct gui_window_2
*gwin)
if(!browser_window_reload_available(gwin->gw->bw))
reload=TRUE;
- if(nsoption_bool(kiosk_mode) == false)
- {
- if(gwin->tabs <= 1)
- {
+ if(nsoption_bool(kiosk_mode) == false) {
+ if(gwin->tabs <= 1) {
tabclose=TRUE;
- OffMenu(gwin->win,AMI_MENU_CLOSETAB);
- }
- else
- {
- OnMenu(gwin->win,AMI_MENU_CLOSETAB);
+ ami_menu_set_disabled(gwin->win, gwin->imenu,
M_CLOSETAB, true);
+ } else {
+ ami_menu_set_disabled(gwin->win, gwin->imenu,
M_CLOSETAB, false);
}
}
@@ -5262,7 +5258,7 @@ static void gui_window_place_caret(struct gui_window *g,
int x, int y, int heigh
g->c_h = height;
if((nsoption_bool(kiosk_mode) == false))
- OnMenu(g->shared->win, AMI_MENU_PASTE);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu,
M_PASTE, false);
}
static void gui_window_remove_caret(struct gui_window *g)
@@ -5271,7 +5267,7 @@ static void gui_window_remove_caret(struct gui_window *g)
if(g->c_h == 0) return;
if((nsoption_bool(kiosk_mode) == false))
- OffMenu(g->shared->win, AMI_MENU_PASTE);
+ ami_menu_set_disabled(g->shared->win, g->shared->imenu,
M_PASTE, true);
ami_do_redraw_limits(g, g->bw, false, g->c_x, g->c_y,
g->c_x + g->c_w + 1, g->c_y + g->c_h + 1);
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 97debb6..175fe15 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -111,6 +111,25 @@ const char * const verdate;
static nserror ami_menu_scan(struct ami_menu_data **md);
void ami_menu_arexx_scan(struct ami_menu_data **md);
+static bool ami_menu_get_selected(struct Menu *menu, struct IntuiMessage *msg)
+{
+ bool checked = false;
+
+ if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
+#ifdef __amigaos4__
+ ULONG state;
+ struct ExtIntuiMessage *emsg = (struct ExtIntuiMessage *)msg;
+
+ state = IDoMethod(menu, MM_GETSTATE, 0, emsg->eim_LongCode,
MS_CHECKED);
+ if(state & MS_CHECKED) checked = true;
+#endif
+ } else {
+ if(ItemAddress(menu, msg->Code)->Flags & CHECKED) checked =
true;
+ }
+
+ return checked;
+}
+
void ami_menu_set_check_toggled(void)
{
ami_menu_check_toggled = true;
@@ -378,8 +397,8 @@ HOOKF(void, ami_menu_item_browser_foreimg, APTR, window,
struct IntuiMessage *)
bool checked = false;
GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
- if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
-
+ checked = ami_menu_get_selected(menustrip, msg);
+
nsoption_set_bool(foreground_images, checked);
ami_menu_set_check_toggled();
}
@@ -390,7 +409,7 @@ HOOKF(void, ami_menu_item_browser_backimg, APTR, window,
struct IntuiMessage *)
bool checked = false;
GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
- if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
+ checked = ami_menu_get_selected(menustrip, msg);
nsoption_set_bool(background_images, checked);
ami_menu_set_check_toggled();
@@ -402,7 +421,7 @@ HOOKF(void, ami_menu_item_browser_enablejs, APTR, window,
struct IntuiMessage *)
bool checked = false;
GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
- if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
+ checked = ami_menu_get_selected(menustrip, msg);
nsoption_set_bool(enable_javascript, checked);
ami_menu_set_check_toggled();
@@ -978,7 +997,7 @@ static struct Menu *ami_menu_layout_gt(struct ami_menu_data
**md, int max)
TextLength(rp, md[i]->menulab,
strlen(md[i]->menulab)) -
icon_width - space_width;
- if((md[i]->menutype == NM_ITEM) &&
(md[i+1]->menutype == NM_SUB)) {
+ if((md[i]->menutype == NM_ITEM) && md[i+1] &&
(md[i+1]->menutype == NM_SUB)) {
left_posn -=
menu_glyph_width[NSA_GLYPH_SUBMENU];
submenuarrow = NewObject(NULL,
"sysiclass",
@@ -1175,6 +1194,120 @@ static nserror ami_menu_scan(struct ami_menu_data **md)
return ami_hotlist_scan((void *)md, AMI_MENU_HOTLIST,
messages_get("HotlistMenu"), ami_menu_hotlist_add);
}
+#ifdef __amigaos4__
+void ami_menu_set_disabled_mc(struct Window *win, struct Menu *menu, int item,
bool disable)
+{
+ ULONG disable_state = MS_DISABLED;
+
+ if(disable == false) {
+ disable_state = 0;
+ }
+
+ IDoMethod(menu, MM_SETSTATE, 0, item, MS_DISABLED, disable_state);
+}
+#endif
+
+static ULONG ami_menu_number(int item)
+{
+ /* horrible, horrible, horrible */
+ ULONG menu_num;
+
+ switch(item) {
+ case M_SAVETXT:
+ menu_num = FULLMENUNUM(0,4,1);
+ break;
+
+ case M_SAVECOMP:
+ menu_num = FULLMENUNUM(0,4,2);
+ break;
+
+ case M_SAVEIFF:
+ menu_num = FULLMENUNUM(0,4,3);
+ break;
+#ifdef WITH_PDF_EXPORT:
+ case M_SAVEPDF:
+ menu_num = FULLMENUNUM(0,4,4);
+ break;
+#endif
+ case M_CLOSETAB:
+ menu_num = FULLMENUNUM(0,8,0);
+ break;
+
+ case M_CUT:
+ menu_num = FULLMENUNUM(1,0,0);
+ break;
+
+ case M_COPY:
+ menu_num = FULLMENUNUM(1,1,0);
+ break;
+
+ case M_PASTE:
+ menu_num = FULLMENUNUM(1,2,0);
+ break;
+
+ case M_SELALL:
+ menu_num = FULLMENUNUM(1,4,0);
+ break;
+
+ case M_CLEAR:
+ menu_num = FULLMENUNUM(1,5,0);
+ break;
+
+ case M_UNDO:
+ menu_num = FULLMENUNUM(1,8,0);
+ break;
+
+ case M_REDO:
+ menu_num = FULLMENUNUM(1,9,0);
+ break;
+
+ case M_FIND:
+ menu_num = FULLMENUNUM(2,0,0);
+ break;
+
+ case M_IMGFORE:
+ menu_num = FULLMENUNUM(2,8,0);
+ break;
+
+ case M_IMGBACK:
+ menu_num = FULLMENUNUM(2,8,1);
+ break;
+
+ case M_JS:
+ menu_num = FULLMENUNUM(2,9,0);
+ break;
+
+ default:
+ LOG("WARNING: Unrecognised menu item %d", item);
+ menu_num = 0;
+ break;
+ }
+
+ return menu_num;
+}
+
+static void ami_menu_set_disabled_gt(struct Window *win, struct Menu *menu,
int item, bool disable)
+{
+ ULONG menu_num = ami_menu_number(item);
+
+ if(disable == false) {
+ OnMenu(win, menu_num);
+ } else {
+ OffMenu(win, menu_num);
+ }
+}
+
+void ami_menu_set_disabled(struct Window *win, struct Menu *menu, int item,
bool disable)
+{
+ if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
+#ifdef __amigaos4__
+ return ami_menu_set_disabled_mc(win, menu, item, disable);
+#endif
+ } else {
+ return ami_menu_set_disabled_gt(win, menu, item, disable);
+ }
+}
+
void ami_menu_update_checked(struct gui_window_2 *gwin)
{
if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 54, 6)) {
@@ -1187,26 +1320,26 @@ void ami_menu_update_checked(struct gui_window_2 *gwin)
GetAttr(WINDOW_MenuStrip, gwin->objects[OID_MAIN], (ULONG *)&menustrip);
if(!menustrip) return;
if(nsoption_bool(enable_javascript) == true) {
- if((ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED) == 0)
- ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED;
+ if((ItemAddress(menustrip, ami_menu_number(M_JS))->Flags &
CHECKED) == 0)
+ ItemAddress(menustrip, ami_menu_number(M_JS))->Flags ^=
CHECKED;
} else {
- if(ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED)
- ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED;
+ if(ItemAddress(menustrip, ami_menu_number(M_JS))->Flags &
CHECKED)
+ ItemAddress(menustrip, ami_menu_number(M_JS))->Flags ^=
CHECKED;
}
if(nsoption_bool(foreground_images) == true) {
- if((ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED)
== 0)
- ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^=
CHECKED;
+ if((ItemAddress(menustrip, ami_menu_number(M_IMGFORE))->Flags &
CHECKED) == 0)
+ ItemAddress(menustrip,
ami_menu_number(M_IMGFORE))->Flags ^= CHECKED;
} else {
- if(ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED)
- ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^=
CHECKED;
+ if(ItemAddress(menustrip, ami_menu_number(M_IMGFORE))->Flags &
CHECKED)
+ ItemAddress(menustrip,
ami_menu_number(M_IMGFORE))->Flags ^= CHECKED;
}
if(nsoption_bool(background_images) == true) {
- if((ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags & CHECKED)
== 0)
- ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags ^=
CHECKED;
+ if((ItemAddress(menustrip, ami_menu_number(M_IMGBACK))->Flags &
CHECKED) == 0)
+ ItemAddress(menustrip,
ami_menu_number(M_IMGBACK))->Flags ^= CHECKED;
} else {
- if(ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags & CHECKED)
- ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags ^=
CHECKED;
+ if(ItemAddress(menustrip, ami_menu_number(M_IMGBACK))->Flags &
CHECKED)
+ ItemAddress(menustrip,
ami_menu_number(M_IMGBACK))->Flags ^= CHECKED;
}
ResetMenuStrip(gwin->win, menustrip);
@@ -1220,10 +1353,10 @@ void ami_menu_update_disabled(struct gui_window *g,
struct hlcache_handle *c)
if(content_get_type(c) <= CONTENT_CSS)
{
- OnMenu(win,AMI_MENU_SAVEAS_TEXT);
- OnMenu(win,AMI_MENU_SAVEAS_COMPLETE);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVETXT, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVECOMP, false);
#ifdef WITH_PDF_EXPORT
- OnMenu(win,AMI_MENU_SAVEAS_PDF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEPDF, false);
#endif
#if 0
if(browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_COPY)
{
@@ -1244,28 +1377,29 @@ void ami_menu_update_disabled(struct gui_window *g,
struct hlcache_handle *c)
else
OffMenu(win,AMI_MENU_PASTE);
#else
- OnMenu(win,AMI_MENU_CUT);
- OnMenu(win,AMI_MENU_COPY);
- OnMenu(win,AMI_MENU_PASTE);
- OnMenu(win,AMI_MENU_CLEAR);
+ ami_menu_set_disabled(win, g->shared->imenu, M_CUT, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_COPY, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_PASTE, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_CLEAR, false);
#endif
- OnMenu(win,AMI_MENU_SELECTALL);
- OnMenu(win,AMI_MENU_FIND);
- OffMenu(win,AMI_MENU_SAVEAS_IFF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SELALL, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_FIND, false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEIFF, true);
}
else
{
- OffMenu(win,AMI_MENU_CUT);
- OffMenu(win,AMI_MENU_PASTE);
- OffMenu(win,AMI_MENU_CLEAR);
+ ami_menu_set_disabled(win, g->shared->imenu, M_CUT, true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_PASTE, true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_CLEAR, true);
- OffMenu(win,AMI_MENU_SAVEAS_TEXT);
- OffMenu(win,AMI_MENU_SAVEAS_COMPLETE);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVETXT, true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVECOMP, true);
#ifdef WITH_PDF_EXPORT
- OffMenu(win,AMI_MENU_SAVEAS_PDF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEPDF, true);
#endif
- OffMenu(win,AMI_MENU_SELECTALL);
- OffMenu(win,AMI_MENU_FIND);
+
+ ami_menu_set_disabled(win, g->shared->imenu, M_SELALL, true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_FIND, true);
#ifdef WITH_NS_SVG
if(content_get_bitmap(c) || (ami_mime_compare(c, "svg") ==
true))
@@ -1273,13 +1407,13 @@ void ami_menu_update_disabled(struct gui_window *g,
struct hlcache_handle *c)
if(content_get_bitmap(c))
#endif
{
- OnMenu(win,AMI_MENU_COPY);
- OnMenu(win,AMI_MENU_SAVEAS_IFF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_COPY,
false);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEIFF,
false);
}
else
{
- OffMenu(win,AMI_MENU_COPY);
- OffMenu(win,AMI_MENU_SAVEAS_IFF);
+ ami_menu_set_disabled(win, g->shared->imenu, M_COPY,
true);
+ ami_menu_set_disabled(win, g->shared->imenu, M_SAVEIFF,
true);
}
}
}
diff --git a/frontends/amiga/menu.h b/frontends/amiga/menu.h
index ad0e96d..43f7e1e 100644
--- a/frontends/amiga/menu.h
+++ b/frontends/amiga/menu.h
@@ -115,24 +115,6 @@ enum {
* only used for freeing the UTF-8 converted menu labels */
#define AMI_MENU_MAX AMI_MENU_AREXX
-/* The Intuition menu numbers of some menus we might need to modify */
-#define AMI_MENU_SAVEAS_TEXT FULLMENUNUM(0,4,1)
-#define AMI_MENU_SAVEAS_COMPLETE FULLMENUNUM(0,4,2)
-#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,3)
-#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,4)
-#define AMI_MENU_CLOSETAB FULLMENUNUM(0,8,0)
-#define AMI_MENU_CUT FULLMENUNUM(1,0,0)
-#define AMI_MENU_COPY FULLMENUNUM(1,1,0)
-#define AMI_MENU_PASTE FULLMENUNUM(1,2,0)
-#define AMI_MENU_SELECTALL FULLMENUNUM(1,4,0)
-#define AMI_MENU_CLEAR FULLMENUNUM(1,5,0)
-#define AMI_MENU_UNDO FULLMENUNUM(1,8,0)
-#define AMI_MENU_REDO FULLMENUNUM(1,9,0)
-#define AMI_MENU_FIND FULLMENUNUM(2,0,0)
-#define AMI_MENU_FOREIMG FULLMENUNUM(2,8,0)
-#define AMI_MENU_BACKIMG FULLMENUNUM(2,8,1)
-#define AMI_MENU_JS FULLMENUNUM(2,9,0)
-
struct gui_window;
struct gui_window_2;
@@ -155,6 +137,11 @@ void ami_menu_update_disabled(struct gui_window *g, struct
hlcache_handle *c);
void ami_menu_free(struct gui_window_2 *gwin);
/**
+ * Set disabled state of a menu item
+ */
+void ami_menu_set_disabled(struct Window *win, struct Menu *menu, int item,
bool disable);
+
+/**
* Sets that an item linked to a toggle menu item has been changed.
*/
void ami_menu_set_check_toggled(void);
diff --git a/frontends/atari/plot/font_freetype.c
b/frontends/atari/plot/font_freetype.c
index 6028207..8b535e3 100644
--- a/frontends/atari/plot/font_freetype.c
+++ b/frontends/atari/plot/font_freetype.c
@@ -25,7 +25,7 @@
#include "utils/log.h"
#include "utils/nsoption.h"
#include "netsurf/mouse.h"
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
#include "atari/gui.h"
#include "atari/bitmap.h"
diff --git a/frontends/atari/plot/font_internal.c
b/frontends/atari/plot/font_internal.c
index b96f4c7..6a811e3 100644
--- a/frontends/atari/plot/font_internal.c
+++ b/frontends/atari/plot/font_internal.c
@@ -25,7 +25,7 @@
#include "utils/utf8.h"
#include "utils/log.h"
#include "netsurf/mouse.h"
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
#include "atari/gui.h"
#include "atari/bitmap.h"
diff --git a/frontends/atari/plot/fontplot.c b/frontends/atari/plot/fontplot.c
index d0a1fe1..2e02b50 100644
--- a/frontends/atari/plot/fontplot.c
+++ b/frontends/atari/plot/fontplot.c
@@ -22,7 +22,7 @@
#include <mt_gem.h>
#include "netsurf/mouse.h"
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
#include "atari/bitmap.h"
#include "atari/plot/fontplot.h"
diff --git a/frontends/atari/settings.c b/frontends/atari/settings.c
index b6df127..5759a89 100644
--- a/frontends/atari/settings.c
+++ b/frontends/atari/settings.c
@@ -32,7 +32,7 @@
#include "utils/dirent.h"
#include "utils/nsoption.h"
#include "utils/log.h"
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
#include "atari/gui.h"
#include "atari/res/netsurf.rsh"
diff --git a/frontends/atari/toolbar.c b/frontends/atari/toolbar.c
index 66bd44b..9ed8784 100644
--- a/frontends/atari/toolbar.c
+++ b/frontends/atari/toolbar.c
@@ -35,7 +35,6 @@
#include "netsurf/mouse.h"
#include "netsurf/plotters.h"
#include "netsurf/keypress.h"
-#include "desktop/plot_style.h"
#include "desktop/browser_history.h"
#include "desktop/hotlist.h"
#include "desktop/textarea.h"
diff --git a/frontends/beos/font.h b/frontends/beos/font.h
index 63909ef..285ba9c 100644
--- a/frontends/beos/font.h
+++ b/frontends/beos/font.h
@@ -24,7 +24,7 @@
#ifndef NS_BEOS_FONT_H
#define NS_BEOS_FONT_H
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
bool nsfont_paint(const plot_font_style_t *fstyle,
const char *string, size_t length,
diff --git a/frontends/cocoa/font.h b/frontends/cocoa/font.h
index cabd2b9..ed04797 100644
--- a/frontends/cocoa/font.h
+++ b/frontends/cocoa/font.h
@@ -19,7 +19,7 @@
#ifndef COCOA_FONT_H
#define COCOA_FONT_H
-#import "desktop/plot_style.h"
+#import "netsurf/plot_style.h"
void cocoa_draw_string( CGFloat x, CGFloat y, const char *bytes, size_t
length, const struct plot_font_style *style );
diff --git a/frontends/cocoa/plotter.h b/frontends/cocoa/plotter.h
index 88f9fca..ce48653 100644
--- a/frontends/cocoa/plotter.h
+++ b/frontends/cocoa/plotter.h
@@ -20,7 +20,7 @@
#define COCOA_PLOTTER_H
#import <Cocoa/Cocoa.h>
-#import "desktop/plot_style.h"
+#import "netsurf/plot_style.h"
extern const struct plotter_table cocoa_plotters;
diff --git a/frontends/cocoa/plotter.m b/frontends/cocoa/plotter.m
index 20b6884..dea3245 100644
--- a/frontends/cocoa/plotter.m
+++ b/frontends/cocoa/plotter.m
@@ -22,7 +22,6 @@
#import "utils/utils.h"
#import "netsurf/browser_window.h"
#import "netsurf/plotters.h"
-#import "desktop/plot_style.h"
#import "cocoa/font.h"
#import "cocoa/coordinates.h"
diff --git a/frontends/framebuffer/convert_image.c
b/frontends/framebuffer/convert_image.c
index 2608328..de772fc 100644
--- a/frontends/framebuffer/convert_image.c
+++ b/frontends/framebuffer/convert_image.c
@@ -262,7 +262,7 @@ main(int argc, char **argv)
fprintf(f, "#include <stdint.h>\n\n");
fprintf(f, "#include <stdbool.h>\n\n");
fprintf(f, "#include <libnsfb.h>\n\n");
- fprintf(f, "#include \"desktop/plot_style.h\"\n");
+ fprintf(f, "#include \"netsurf/plot_style.h\"\n");
fprintf(f, "#include \"framebuffer/gui.h\"\n");
fprintf(f, "#include \"framebuffer/fbtk.h\"\n\n");
diff --git a/frontends/framebuffer/fbtk.h b/frontends/framebuffer/fbtk.h
index fe4f5a5..3cc326c 100644
--- a/frontends/framebuffer/fbtk.h
+++ b/frontends/framebuffer/fbtk.h
@@ -19,7 +19,7 @@
#ifndef NETSURF_FB_FBTK_H
#define NETSURF_FB_FBTK_H
-#include "desktop/plot_style.h"
+#include "netsurf/types.h"
#ifdef FBTK_LOGGING
#define FBTK_LOG(x) LOG(x)
diff --git a/frontends/framebuffer/fbtk/user.c
b/frontends/framebuffer/fbtk/user.c
index 2b9cc87..de547ab 100644
--- a/frontends/framebuffer/fbtk/user.c
+++ b/frontends/framebuffer/fbtk/user.c
@@ -22,7 +22,6 @@
#include <stdbool.h>
#include <libnsfb.h>
-#include "desktop/plot_style.h"
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
diff --git a/frontends/framebuffer/font_freetype.c
b/frontends/framebuffer/font_freetype.c
index 3239820..ccc60ea 100644
--- a/frontends/framebuffer/font_freetype.c
+++ b/frontends/framebuffer/font_freetype.c
@@ -30,6 +30,7 @@
#include "netsurf/utf8.h"
#include "netsurf/layout.h"
#include "netsurf/browser_window.h"
+#include "netsurf/plot_style.h"
#include "framebuffer/gui.h"
#include "framebuffer/font.h"
diff --git a/frontends/framebuffer/font_internal.c
b/frontends/framebuffer/font_internal.c
index 3fd3ac6..3b8a1c4 100644
--- a/frontends/framebuffer/font_internal.c
+++ b/frontends/framebuffer/font_internal.c
@@ -26,6 +26,7 @@
#include "utils/utf8.h"
#include "netsurf/utf8.h"
#include "netsurf/layout.h"
+#include "netsurf/plot_style.h"
#include "framebuffer/gui.h"
#include "framebuffer/font.h"
diff --git a/frontends/gtk/corewindow.c b/frontends/gtk/corewindow.c
index 9f66ef1..8af1958 100644
--- a/frontends/gtk/corewindow.c
+++ b/frontends/gtk/corewindow.c
@@ -42,9 +42,9 @@
#include "utils/utils.h"
#include "utils/messages.h"
#include "utils/utf8.h"
+#include "netsurf/types.h"
#include "netsurf/keypress.h"
#include "netsurf/mouse.h"
-#include "desktop/plot_style.h"
#include "gtk/compat.h"
#include "gtk/gui.h" /* just for gtk_gui_gdkkey_to_nskey */
diff --git a/frontends/gtk/layout_pango.c b/frontends/gtk/layout_pango.c
index a0196df..7c71909 100644
--- a/frontends/gtk/layout_pango.c
+++ b/frontends/gtk/layout_pango.c
@@ -31,6 +31,7 @@
#include "utils/log.h"
#include "utils/nsoption.h"
#include "netsurf/layout.h"
+#include "netsurf/plot_style.h"
#include "gtk/layout_pango.h"
#include "gtk/plotters.h"
diff --git a/frontends/monkey/layout.c b/frontends/monkey/layout.c
index 00ed9df..4bcc51b 100644
--- a/frontends/monkey/layout.c
+++ b/frontends/monkey/layout.c
@@ -24,7 +24,7 @@
#include <stddef.h>
#include "utils/utf8.h"
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
#include "netsurf/layout.h"
#include "monkey/layout.h"
diff --git a/frontends/riscos/configure/con_fonts.c
b/frontends/riscos/configure/con_fonts.c
index 2803128..ecbf396 100644
--- a/frontends/riscos/configure/con_fonts.c
+++ b/frontends/riscos/configure/con_fonts.c
@@ -21,7 +21,7 @@
#include "utils/nsoption.h"
#include "utils/messages.h"
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
#include "riscos/gui.h"
#include "riscos/font.h"
diff --git a/frontends/riscos/font.c b/frontends/riscos/font.c
index a7a394e..560afc7 100644
--- a/frontends/riscos/font.c
+++ b/frontends/riscos/font.c
@@ -35,6 +35,7 @@
#include "utils/messages.h"
#include "utils/utils.h"
#include "netsurf/layout.h"
+#include "netsurf/plot_style.h"
#include "riscos/gui.h"
#include "riscos/font.h"
diff --git a/frontends/riscos/font.h b/frontends/riscos/font.h
index 0319a7e..a29bad8 100644
--- a/frontends/riscos/font.h
+++ b/frontends/riscos/font.h
@@ -25,6 +25,7 @@
#include <rufl.h>
+struct plot_font_style;
struct gui_layout_table *riscos_layout_table;
/** desktop font, size and style being used */
@@ -35,9 +36,9 @@ extern rufl_style ro_gui_desktop_font_style;
void nsfont_init(void);
bool nsfont_exists(const char *font_family);
const char *nsfont_fallback_font(void);
-bool nsfont_paint(const plot_font_style_t *fstyle, const char *string,
+bool nsfont_paint(const struct plot_font_style *fstyle, const char *string,
size_t length, int x, int y);
-void nsfont_read_style(const plot_font_style_t *fstyle,
+void nsfont_read_style(const struct plot_font_style *fstyle,
const char **font_family, unsigned int *font_size,
rufl_style *font_style);
void ro_gui_wimp_get_desktop_font(void);
diff --git a/frontends/riscos/image.h b/frontends/riscos/image.h
index a11388c..2ed3e18 100644
--- a/frontends/riscos/image.h
+++ b/frontends/riscos/image.h
@@ -20,7 +20,7 @@
#define _NETSURF_RISCOS_IMAGE_H_
#include <stdbool.h>
-#include "desktop/plot_style.h"
+#include "netsurf/types.h"
#include "oslib/osspriteop.h"
struct osspriteop_area;
diff --git a/frontends/riscos/templates/de b/frontends/riscos/templates/de
index 0fb4a9d..a4ec1f4 100644
--- a/frontends/riscos/templates/de
+++ b/frontends/riscos/templates/de
@@ -2542,7 +2542,7 @@ wimp_window {
xscroll:0
yscroll:0
next:wimp_TOP
- window_flags:wimp_WINDOW_MOVEABLE | wimp_WINDOW_SCROLL_REPEAT |
wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT | wimp_WINDOW_BACK_ICON
| wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_TITLE_ICON | wimp_WINDOW_TOGGLE_ICON |
wimp_WINDOW_VSCROLL | wimp_WINDOW_SIZE_ICON | wimp_WINDOW_HSCROLL |
wimp_WINDOW_NEW_FORMAT
+ window_flags:wimp_WINDOW_MOVEABLE | wimp_WINDOW_SCROLL_REPEAT |
wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT | wimp_WINDOW_BACK_ICON
| wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_TITLE_ICON | wimp_WINDOW_TOGGLE_ICON |
wimp_WINDOW_VSCROLL | wimp_WINDOW_SIZE_ICON | wimp_WINDOW_HSCROLL |
wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_NO_BOUNDS
title_fg:wimp_COLOUR_BLACK
title_bg:wimp_COLOUR_LIGHT_GREY
work_fg:wimp_COLOUR_BLACK
diff --git a/frontends/riscos/templates/en b/frontends/riscos/templates/en
index 7746b86..25be55f 100644
--- a/frontends/riscos/templates/en
+++ b/frontends/riscos/templates/en
@@ -2750,7 +2750,7 @@ wimp_window {
xscroll:0
yscroll:0
next:wimp_TOP
- window_flags:wimp_WINDOW_MOVEABLE | wimp_WINDOW_SCROLL_REPEAT |
wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT |
wimp_WINDOW_BOUNDED_ONCE | wimp_WINDOW_BACK_ICON | wimp_WINDOW_CLOSE_ICON |
wimp_WINDOW_TITLE_ICON | wimp_WINDOW_TOGGLE_ICON | wimp_WINDOW_VSCROLL |
wimp_WINDOW_SIZE_ICON | wimp_WINDOW_HSCROLL | wimp_WINDOW_NEW_FORMAT
+ window_flags:wimp_WINDOW_MOVEABLE | wimp_WINDOW_SCROLL_REPEAT |
wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT |
wimp_WINDOW_BOUNDED_ONCE | wimp_WINDOW_BACK_ICON | wimp_WINDOW_CLOSE_ICON |
wimp_WINDOW_TITLE_ICON | wimp_WINDOW_TOGGLE_ICON | wimp_WINDOW_VSCROLL |
wimp_WINDOW_SIZE_ICON | wimp_WINDOW_HSCROLL | wimp_WINDOW_NEW_FORMAT |
wimp_WINDOW_NO_BOUNDS
title_fg:wimp_COLOUR_BLACK
title_bg:wimp_COLOUR_LIGHT_GREY
work_fg:wimp_COLOUR_BLACK
diff --git a/frontends/riscos/templates/fr b/frontends/riscos/templates/fr
index 6779264..fafe0ce 100644
--- a/frontends/riscos/templates/fr
+++ b/frontends/riscos/templates/fr
@@ -2554,7 +2554,7 @@ wimp_window {
xscroll:0
yscroll:0
next:wimp_TOP
- window_flags:wimp_WINDOW_MOVEABLE | wimp_WINDOW_SCROLL_REPEAT |
wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT |
wimp_WINDOW_BOUNDED_ONCE | wimp_WINDOW_BACK_ICON | wimp_WINDOW_CLOSE_ICON |
wimp_WINDOW_TITLE_ICON | wimp_WINDOW_TOGGLE_ICON | wimp_WINDOW_VSCROLL |
wimp_WINDOW_SIZE_ICON | wimp_WINDOW_HSCROLL | wimp_WINDOW_NEW_FORMAT
+ window_flags:wimp_WINDOW_MOVEABLE | wimp_WINDOW_SCROLL_REPEAT |
wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT |
wimp_WINDOW_BOUNDED_ONCE | wimp_WINDOW_BACK_ICON | wimp_WINDOW_CLOSE_ICON |
wimp_WINDOW_TITLE_ICON | wimp_WINDOW_TOGGLE_ICON | wimp_WINDOW_VSCROLL |
wimp_WINDOW_SIZE_ICON | wimp_WINDOW_HSCROLL | wimp_WINDOW_NEW_FORMAT |
wimp_WINDOW_NO_BOUNDS
title_fg:wimp_COLOUR_BLACK
title_bg:wimp_COLOUR_LIGHT_GREY
work_fg:wimp_COLOUR_BLACK
diff --git a/frontends/riscos/templates/nl b/frontends/riscos/templates/nl
index 704206f..5ed9cac 100644
--- a/frontends/riscos/templates/nl
+++ b/frontends/riscos/templates/nl
@@ -2796,7 +2796,7 @@ wimp_window {
xscroll:0
yscroll:0
next:wimp_TOP
- window_flags:wimp_WINDOW_MOVEABLE | wimp_WINDOW_SCROLL_REPEAT |
wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT |
wimp_WINDOW_BOUNDED_ONCE | wimp_WINDOW_BACK_ICON | wimp_WINDOW_CLOSE_ICON |
wimp_WINDOW_TITLE_ICON | wimp_WINDOW_TOGGLE_ICON | wimp_WINDOW_VSCROLL |
wimp_WINDOW_SIZE_ICON | wimp_WINDOW_HSCROLL | wimp_WINDOW_NEW_FORMAT
+ window_flags:wimp_WINDOW_MOVEABLE | wimp_WINDOW_SCROLL_REPEAT |
wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT |
wimp_WINDOW_BOUNDED_ONCE | wimp_WINDOW_BACK_ICON | wimp_WINDOW_CLOSE_ICON |
wimp_WINDOW_TITLE_ICON | wimp_WINDOW_TOGGLE_ICON | wimp_WINDOW_VSCROLL |
wimp_WINDOW_SIZE_ICON | wimp_WINDOW_HSCROLL | wimp_WINDOW_NEW_FORMAT |
wimp_WINDOW_NO_BOUNDS
title_fg:wimp_COLOUR_BLACK
title_bg:wimp_COLOUR_LIGHT_GREY
work_fg:wimp_COLOUR_BLACK
diff --git a/frontends/windows/corewindow.c b/frontends/windows/corewindow.c
index 8d853fb..ff89d92 100644
--- a/frontends/windows/corewindow.c
+++ b/frontends/windows/corewindow.c
@@ -43,7 +43,6 @@
#include "utils/utf8.h"
#include "netsurf/keypress.h"
#include "netsurf/mouse.h"
-#include "desktop/plot_style.h"
#include "windows/windbg.h"
#include "windows/corewindow.h"
diff --git a/frontends/windows/font.c b/frontends/windows/font.c
index 1e99a78..791b8cd 100644
--- a/frontends/windows/font.c
+++ b/frontends/windows/font.c
@@ -32,6 +32,7 @@
#include "utils/utf8.h"
#include "netsurf/layout.h"
#include "netsurf/utf8.h"
+#include "netsurf/plot_style.h"
#include "windows/font.h"
diff --git a/frontends/windows/font.h b/frontends/windows/font.h
index 0e86755..a1077e0 100644
--- a/frontends/windows/font.h
+++ b/frontends/windows/font.h
@@ -25,6 +25,8 @@
#ifndef NETSURF_WINDOWS_FONT_H
#define NETSURF_WINDOWS_FONT_H
+struct plot_font_style;
+
extern HWND font_hwnd;
struct font_desc {
@@ -47,7 +49,7 @@ extern nserror utf8_to_font_encoding(const struct font_desc*
font,
* \param style The font style.
* \return The win32 font handle
*/
-HFONT get_font(const plot_font_style_t *style);
+HFONT get_font(const struct plot_font_style *style);
#endif /* NETSURF_WINDOWS_FONT_H */
diff --git a/include/netsurf/clipboard.h b/include/netsurf/clipboard.h
index d90ebc4..ab8d10a 100644
--- a/include/netsurf/clipboard.h
+++ b/include/netsurf/clipboard.h
@@ -28,7 +28,7 @@
#include <stddef.h>
#include "utils/errors.h"
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
typedef struct nsnsclipboard_styles {
size_t start; /**< Start of run */
diff --git a/include/netsurf/content.h b/include/netsurf/content.h
index 35b8b33..5eee59a 100644
--- a/include/netsurf/content.h
+++ b/include/netsurf/content.h
@@ -28,7 +28,7 @@
#include <libwapcaplet/libwapcaplet.h>
-#include "desktop/plot_style.h" /* color typedef */
+#include "netsurf/types.h"
#include "netsurf/content_type.h"
struct bitmap;
diff --git a/desktop/plot_style.h b/include/netsurf/plot_style.h
similarity index 88%
rename from desktop/plot_style.h
rename to include/netsurf/plot_style.h
index 347c6e8..30db366 100644
--- a/desktop/plot_style.h
+++ b/include/netsurf/plot_style.h
@@ -16,19 +16,88 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Plotter styles.
+/**
+ * \file
+ * plotter style interfaces, generic styles and style colour helpers.
*/
-#ifndef _NETSURF_DESKTOP_PLOT_STYLE_H_
-#define _NETSURF_DESKTOP_PLOT_STYLE_H_
+#ifndef NETSURF_PLOT_STYLE_H
+#define NETSURF_PLOT_STYLE_H
#include <stdint.h>
+#include "netsurf/types.h"
-/* html widget colours */
+/** light grey widget base colour */
#define WIDGET_BASEC 0xd9d9d9
+
+/** black blob colour */
#define WIDGET_BLOBC 0x000000
+/** Transparent colour value. */
+#define NS_TRANSPARENT 0x01000000
+
+/** Scaling factor for font sizes */
+#define FONT_SIZE_SCALE 1024
+
+/**
+ * Type of plot operation
+ */
+typedef enum {
+ PLOT_OP_TYPE_NONE = 0, /**< No operation */
+ PLOT_OP_TYPE_SOLID, /**< Solid colour */
+ PLOT_OP_TYPE_DOT, /**< Dotted plot */
+ PLOT_OP_TYPE_DASH, /**< Dashed plot */
+} plot_operation_type_t;
+
+
+/**
+ * Plot style for stroke/fill plotters
+ */
+typedef struct plot_style_s {
+ plot_operation_type_t stroke_type; /**< Stroke plot type */
+ int stroke_width; /**< Width of stroke, in pixels */
+ colour stroke_colour; /**< Colour of stroke */
+ plot_operation_type_t fill_type; /**< Fill plot type */
+ colour fill_colour; /**< Colour of fill */
+} plot_style_t;
+
+
+/**
+ * Generic font family type
+ */
+typedef enum {
+ PLOT_FONT_FAMILY_SANS_SERIF = 0,
+ PLOT_FONT_FAMILY_SERIF,
+ PLOT_FONT_FAMILY_MONOSPACE,
+ PLOT_FONT_FAMILY_CURSIVE,
+ PLOT_FONT_FAMILY_FANTASY,
+ PLOT_FONT_FAMILY_COUNT /**< Number of generic families */
+} plot_font_generic_family_t;
+
+
+/**
+ * Font plot flags
+ */
+typedef enum {
+ FONTF_NONE = 0,
+ FONTF_ITALIC = 1,
+ FONTF_OBLIQUE = 2,
+ FONTF_SMALLCAPS = 4,
+} plot_font_flags_t;
+
+/**
+ * Font style for plotting
+ */
+typedef struct plot_font_style {
+ plot_font_generic_family_t family; /**< Generic family to plot with */
+ int size; /**< Font size, in points * FONT_SIZE_SCALE */
+ int weight; /**< Font weight: value in range [100,900] as per CSS */
+ plot_font_flags_t flags; /**< Font flags */
+ colour background; /**< Background colour to blend to, if appropriate */
+ colour foreground; /**< Colour of text */
+} plot_font_style_t;
+
+
/* Darken a colour by taking three quarters of each channel's intensity */
#define darken_colour(c1) \
((((3 * (c1 & 0xff00ff)) >> 2) & 0xff00ff) | \
@@ -90,85 +159,19 @@
#define blue_from_colour(c) \
((c >> 16) & 0xff)
-/**
- * Colour type: XBGR
- */
-typedef uint32_t colour;
-
-/**
- * Magical transparent value
- */
-#define NS_TRANSPARENT 0x01000000
-
-/**
- * Type of plot operation
- */
-typedef enum {
- PLOT_OP_TYPE_NONE = 0, /**< No operation */
- PLOT_OP_TYPE_SOLID, /**< Solid colour */
- PLOT_OP_TYPE_DOT, /**< Dotted plot */
- PLOT_OP_TYPE_DASH, /**< Dashed plot */
-} plot_operation_type_t;
-
-/**
- * Plot style for stroke/fill plotters
- */
-typedef struct plot_style_s {
- plot_operation_type_t stroke_type; /**< Stroke plot type */
- int stroke_width; /**< Width of stroke, in pixels */
- colour stroke_colour; /**< Colour of stroke */
- plot_operation_type_t fill_type; /**< Fill plot type */
- colour fill_colour; /**< Colour of fill */
-} plot_style_t;
-
-/**
- * Generic font family type
- */
-typedef enum {
- PLOT_FONT_FAMILY_SANS_SERIF = 0,
- PLOT_FONT_FAMILY_SERIF,
- PLOT_FONT_FAMILY_MONOSPACE,
- PLOT_FONT_FAMILY_CURSIVE,
- PLOT_FONT_FAMILY_FANTASY,
- PLOT_FONT_FAMILY_COUNT /**< Number of generic families */
-} plot_font_generic_family_t;
-
-/**
- * Font plot flags
- */
-typedef unsigned long plot_font_flags_t;
-#define FONTF_NONE 0
-#define FONTF_ITALIC 1
-#define FONTF_OBLIQUE 2
-#define FONTF_SMALLCAPS 4
-
-/**
- * Scaling factor for font sizes
- */
-#define FONT_SIZE_SCALE 1024
-
-/**
- * Font style for plotting
- */
-typedef struct plot_font_style {
- plot_font_generic_family_t family; /**< Generic family to plot with */
- int size; /**< Font size, in points * FONT_SIZE_SCALE */
- int weight; /**< Font weight: value in range [100,900] as per CSS */
- plot_font_flags_t flags; /**< Font flags */
- colour background; /**< Background colour to blend to, if appropriate */
- colour foreground; /**< Colour of text */
-} plot_font_style_t;
/* global fill styles */
extern plot_style_t *plot_style_fill_white;
extern plot_style_t *plot_style_fill_red;
extern plot_style_t *plot_style_fill_black;
+
/* Box model debug outline styles for content, padding and margin edges */
extern plot_style_t const * const plot_style_content_edge;
extern plot_style_t const * const plot_style_padding_edge;
extern plot_style_t const * const plot_style_margin_edge;
+
/* Broken object replacement styles */
extern plot_style_t const * const plot_style_broken_object;
extern plot_font_style_t const * const plot_fstyle_broken_object;
@@ -176,7 +179,6 @@ extern plot_font_style_t const * const
plot_fstyle_broken_object;
/* other styles */
extern plot_style_t *plot_style_caret;
-extern plot_style_t *plot_style_stroke_history;
extern plot_style_t *plot_style_fill_wbasec;
extern plot_style_t *plot_style_fill_darkwbasec;
extern plot_style_t *plot_style_fill_lightwbasec;
@@ -185,23 +187,9 @@ extern plot_style_t *plot_style_stroke_wblobc;
extern plot_style_t *plot_style_stroke_darkwbasec;
extern plot_style_t *plot_style_stroke_lightwbasec;
+
/* Default font style */
extern plot_font_style_t const * const plot_style_font;
-#ifndef HISTORY_COLOUR_SELECTED
-#define HISTORY_COLOUR_SELECTED 0xFF0000
-#endif
-
-#ifndef HISTORY_COLOUR_FOREGROUND
-#define HISTORY_COLOUR_FOREGROUND 0x333333
-#endif
-
-#ifndef HISTORY_COLOUR_BACKGROUND
-#define HISTORY_COLOUR_BACKGROUND 0xFFFFFF
-#endif
-
-#ifndef HISTORY_COLOUR_LINES
-#define HISTORY_COLOUR_LINES HISTORY_COLOUR_FOREGROUND
-#endif
#endif
diff --git a/include/netsurf/plotters.h b/include/netsurf/plotters.h
index b13c9b2..88cbbe5 100644
--- a/include/netsurf/plotters.h
+++ b/include/netsurf/plotters.h
@@ -27,7 +27,7 @@
#include <stdbool.h>
#include <stdio.h>
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
struct bitmap;
struct rect;
diff --git a/frontends/windows/file.h b/include/netsurf/types.h
similarity index 71%
copy from frontends/windows/file.h
copy to include/netsurf/types.h
index 5262dde..27f2e8f 100644
--- a/frontends/windows/file.h
+++ b/include/netsurf/types.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Vincent Sanders <[email protected]>
+ * Copyright 2017 Vincent Sanders <[email protected]>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -18,12 +18,20 @@
/**
* \file
- * Windows file operation table interface.
+ *
+ * NetSurf types.
+ *
+ * These are convenience types used throughout the browser.
*/
-#ifndef _NETSURF_WINDOWS_FILE_H_
-#define _NETSURF_WINDOWS_FILE_H_
+#ifndef NETSURF_TYPES_H
+#define NETSURF_TYPES_H
+
+#include <stdint.h>
-struct gui_file_table *win32_file_table;
+/**
+ * Colour type: XBGR
+ */
+typedef uint32_t colour;
-#endif
+#endif
diff --git a/render/box_construct.c b/render/box_construct.c
index 4b54a30..d7de68c 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -41,11 +41,12 @@
#include "utils/utils.h"
#include "utils/string.h"
#include "utils/ascii.h"
+#include "netsurf/css.h"
+#include "netsurf/misc.h"
+#include "netsurf/plot_style.h"
#include "content/content_protected.h"
#include "css/hints.h"
#include "css/select.h"
-#include "netsurf/css.h"
-#include "netsurf/misc.h"
#include "desktop/gui_internal.h"
#include "render/box.h"
diff --git a/render/font.c b/render/font.c
index 8128269..94ef877 100644
--- a/render/font.c
+++ b/render/font.c
@@ -23,6 +23,7 @@
*/
#include "utils/nsoption.h"
+#include "netsurf/plot_style.h"
#include "css/utils.h"
#include "render/font.h"
diff --git a/render/font.h b/render/font.h
index e4353df..fba368a 100644
--- a/render/font.h
+++ b/render/font.h
@@ -27,6 +27,8 @@
#ifndef _NETSURF_RENDER_FONT_H_
#define _NETSURF_RENDER_FONT_H_
+struct plot_font_style;
+
/**
* Populate a font style using data from a computed CSS style
*
@@ -34,6 +36,6 @@
* \param fstyle Font style to populate
*/
void font_plot_style_from_css(const css_computed_style *css,
- plot_font_style_t *fstyle);
+ struct plot_font_style *fstyle);
#endif
diff --git a/render/form.c b/render/form.c
index 52e54e4..093b11f 100644
--- a/render/form.c
+++ b/render/form.c
@@ -40,17 +40,16 @@
#include "utils/utf8.h"
#include "utils/utils.h"
#include "utils/ascii.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/mouse.h"
+#include "netsurf/plotters.h"
+#include "netsurf/misc.h"
#include "content/fetch.h"
#include "content/hlcache.h"
#include "css/utils.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/mouse.h"
#include "desktop/knockout.h"
-#include "desktop/plot_style.h"
-#include "netsurf/plotters.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
-#include "netsurf/misc.h"
#include "desktop/gui_internal.h"
#include "render/box.h"
diff --git a/render/html.h b/render/html.h
index 871eb33..b8429fd 100644
--- a/render/html.h
+++ b/render/html.h
@@ -30,10 +30,10 @@
#include <dom/dom.h>
#include <dom/bindings/hubbub/parser.h>
+#include "netsurf/types.h"
#include "netsurf/content_type.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
-#include "desktop/plot_style.h"
#include "desktop/frame_types.h"
struct fetch_multipart_data;
@@ -52,6 +52,7 @@ struct scrollbar_msg_data;
struct search_context;
struct selection;
struct nsurl;
+struct plot_font_style;
/**
* Container for stylesheets used by an HTML document
@@ -158,7 +159,7 @@ void html_overflow_scroll_drag_end(struct scrollbar
*scrollbar,
bool text_redraw(const char *utf8_text, size_t utf8_len,
size_t offset, int space,
- const plot_font_style_t *fstyle,
+ const struct plot_font_style *fstyle,
int x, int y,
const struct rect *clip,
int height,
diff --git a/utils/nsoption.c b/utils/nsoption.c
index 9ac4778..8f05a91 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -32,7 +32,7 @@
#include <string.h>
#include <strings.h>
-#include "desktop/plot_style.h"
+#include "netsurf/plot_style.h"
#include "utils/errors.h"
#include "utils/log.h"
#include "utils/utils.h"
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org