From fcde28d97f3863d8be4f6245e20f6471c9bfacb6 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 1 Jun 2016 07:59:19 +0100 Subject: [PATCH] reduce core header usage --- frontends/amiga/arexx.c | 5 ++--- frontends/amiga/bitmap.c | 5 +---- frontends/amiga/download.c | 1 - frontends/amiga/drag.h | 8 ++++---- frontends/amiga/gui.c | 2 +- frontends/amiga/gui.h | 13 +++++++------ frontends/amiga/history_local.h | 4 +++- frontends/amiga/hotlist.h | 16 ++++++++-------- frontends/amiga/plotters.h | 4 +++- frontends/amiga/search.c | 16 ++++++++++++++++ frontends/amiga/search.h | 28 ++++++++++++++++++++-------- frontends/amiga/theme.h | 5 +++++ 12 files changed, 70 insertions(+), 37 deletions(-) diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c index 8436fdc55..ef9ea537c 100644 --- a/frontends/amiga/arexx.c +++ b/frontends/amiga/arexx.c @@ -29,19 +29,18 @@ #include #include -#include "utils/utils.h" #include "utils/log.h" #include "utils/nsoption.h" #include "utils/nsurl.h" #include "content/hlcache.h" #include "netsurf/browser_window.h" -#include "netsurf/window.h" #include "desktop/version.h" #include "amiga/arexx.h" -#include "amiga/download.h" #include "amiga/gui.h" +#include "amiga/download.h" #include "amiga/hotlist.h" +#include "amiga/tree.h" #include "amiga/libs.h" #include "amiga/misc.h" #include "amiga/theme.h" diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c index 791295f2e..2dc0719bb 100644 --- a/frontends/amiga/bitmap.c +++ b/frontends/amiga/bitmap.c @@ -43,18 +43,15 @@ #endif #include "assert.h" -#include "utils/log.h" #include "utils/nsoption.h" #include "utils/nsurl.h" #include "utils/messages.h" #include "content/hlcache.h" -#include "netsurf/mouse.h" -#include "netsurf/window.h" #include "netsurf/bitmap.h" #include "amiga/gui.h" #include "amiga/bitmap.h" -#include "amiga/download.h" +#include "amiga/plotters.h" #include "amiga/misc.h" #include "amiga/rtg.h" diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c index fb020cee6..f39ddaede 100644 --- a/frontends/amiga/download.c +++ b/frontends/amiga/download.c @@ -62,7 +62,6 @@ #include "amiga/bitmap.h" #include "amiga/icon.h" #include "amiga/file.h" -#include "amiga/drag.h" #include "amiga/iff_dr2d.h" #include "amiga/libs.h" #include "amiga/misc.h" diff --git a/frontends/amiga/drag.h b/frontends/amiga/drag.h index f8a165576..ee6774013 100644 --- a/frontends/amiga/drag.h +++ b/frontends/amiga/drag.h @@ -18,15 +18,14 @@ #ifndef AMIGA_DRAG_H #define AMIGA_DRAG_H + #include -#include "netsurf/browser_window.h" #include "netsurf/window.h" -#define AMI_DRAG_THRESHOLD 10 - -struct hlcache_handle; struct Window; +#define AMI_DRAG_THRESHOLD 10 + int drag_save; void *drag_save_data; struct gui_window *drag_save_gui; @@ -41,5 +40,6 @@ void ami_drag_icon_move(void); BOOL ami_drag_in_progress(void); void *ami_window_at_pointer(int type); + #endif diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 3ccb2eb4b..f07383a72 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -4460,7 +4460,7 @@ static void gui_window_destroy(struct gui_window *g) if(!g) return; - if(g->shared->searchwin && (g->shared->searchwin->gwin == g)) + if (ami_search_get_gwin(g->shared->searchwin) == g) { ami_search_close(); win_destroyed = true; diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h index c5c1c3134..12f25d95d 100644 --- a/frontends/amiga/gui.h +++ b/frontends/amiga/gui.h @@ -171,6 +171,13 @@ struct gui_window float scale; }; +struct MinList *window_list; +struct Screen *scrn; +struct MsgPort *sport; +struct gui_window *cur_gw; +struct gui_globals browserglob; +BOOL ami_autoscroll; + void ami_get_msg(void); void ami_try_quit(void); void ami_quit_netsurf(void); @@ -236,11 +243,5 @@ uint32 ami_gui_get_app_id(void); */ STRPTR ami_gui_get_screen_title(void); -struct MinList *window_list; -struct Screen *scrn; -struct MsgPort *sport; -struct gui_window *cur_gw; -struct gui_globals browserglob; -BOOL ami_autoscroll; #endif diff --git a/frontends/amiga/history_local.h b/frontends/amiga/history_local.h index 452fe1512..f7488211c 100755 --- a/frontends/amiga/history_local.h +++ b/frontends/amiga/history_local.h @@ -21,7 +21,8 @@ #include #include -#include "amiga/gui.h" + +struct gui_window; struct history_window { struct nsObject *node; @@ -41,5 +42,6 @@ void ami_history_open(struct gui_window *gw); void ami_history_close(struct history_window *hw); BOOL ami_history_event(struct history_window *hw); + #endif diff --git a/frontends/amiga/hotlist.h b/frontends/amiga/hotlist.h index c50ceecfb..23a97480b 100755 --- a/frontends/amiga/hotlist.h +++ b/frontends/amiga/hotlist.h @@ -19,16 +19,16 @@ #ifndef AMIGA_HOTLIST_H #define AMIGA_HOTLIST_H -#include "desktop/tree.h" -#include "amiga/tree.h" - struct nsurl; - -void ami_hotlist_initialise(const char *hotlist_file); -void ami_hotlist_free(const char *hotlist_file); -nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder, - bool (*cb_add_item)(void *userdata, int level, int item, const char *title, struct nsurl *url, bool folder)); +struct treeview_window; struct treeview_window *hotlist_window; +void ami_hotlist_initialise(const char *hotlist_file); + +void ami_hotlist_free(const char *hotlist_file); + +nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder, bool (*cb_add_item)(void *userdata, int level, int item, const char *title, struct nsurl *url, bool folder)); + + #endif diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h index 8fa2b06ae..45ebbd0ba 100644 --- a/frontends/amiga/plotters.h +++ b/frontends/amiga/plotters.h @@ -18,6 +18,7 @@ #ifndef AMIGA_PLOTTERS_H #define AMIGA_PLOTTERS_H + #include "netsurf/plotters.h" #include #include @@ -44,6 +45,8 @@ struct gui_globals extern const struct plotter_table amiplot; +struct gui_globals *glob; + void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit); void ami_free_layers(struct gui_globals *gg); void ami_clearclipreg(struct gui_globals *gg); @@ -51,5 +54,4 @@ void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox); void ami_plot_release_pens(struct MinList *shared_pens); bool ami_plot_screen_is_palettemapped(void); -struct gui_globals *glob; #endif diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c index aaf54b06d..429545e4f 100755 --- a/frontends/amiga/search.c +++ b/frontends/amiga/search.c @@ -55,6 +55,7 @@ #include "netsurf/search.h" #include "amiga/libs.h" +#include "amiga/gui.h" #include "amiga/misc.h" #include "amiga/search.h" #include "amiga/object.h" @@ -66,6 +67,13 @@ static bool search_insert; +struct find_window { + struct nsObject *node; + struct Window *win; + Object *objects[GID_LAST]; + struct gui_window *gwin; +}; + static struct find_window *fwin = NULL; search_flags_t ami_search_flags(void); @@ -86,6 +94,14 @@ static struct gui_search_table search_table = { struct gui_search_table *amiga_search_table = &search_table; +struct gui_window *ami_search_get_gwin(struct find_window *fw) +{ + if (fw != NULL) { + return fw->gwin; + } + return NULL; +} + /** * Change the displayed search status. * diff --git a/frontends/amiga/search.h b/frontends/amiga/search.h index c4f30eb01..c0c6f01a3 100755 --- a/frontends/amiga/search.h +++ b/frontends/amiga/search.h @@ -19,19 +19,31 @@ #ifndef AMIGA_SEARCH_H #define AMIGA_SEARCH_H -#include "amiga/gui.h" - -struct find_window { - struct nsObject *node; - struct Window *win; - Object *objects[GID_LAST]; - struct gui_window *gwin; -}; +struct gui_search_table; +struct gui_window; struct gui_search_table *amiga_search_table; +/** + * Change the displayed search status. + * + * \param gwin gui window to open search for. + */ void ami_search_open(struct gui_window *gwin); + +/** + * Process search events + */ BOOL ami_search_event(void); + +/** + * Close search + */ void ami_search_close(void); +/** + * Obtain gui window associated with find window. + */ +struct gui_window *ami_search_get_gwin(struct find_window *fw); + #endif diff --git a/frontends/amiga/theme.h b/frontends/amiga/theme.h index f295efee1..34a8dd5c3 100644 --- a/frontends/amiga/theme.h +++ b/frontends/amiga/theme.h @@ -19,6 +19,11 @@ #ifndef AMIGA_THEME_H #define AMIGA_THEME_H +#include "netsurf/mouse.h" + +struct gui_window_2; +struct gui_window; + #define AMI_GUI_POINTER_BLANK GUI_POINTER_PROGRESS+1 #define AMI_GUI_POINTER_DRAG GUI_POINTER_PROGRESS+2 #define AMI_LASTPOINTER AMI_GUI_POINTER_DRAG