From 0bbb4f5a2a9d4fa3f29bcd9fc041646fc68a54be Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 1 Jun 2016 17:48:03 +0100 Subject: Rationalise gui_globals a bit --- frontends/amiga/font_diskfont.c | 1 + frontends/amiga/gui.h | 2 -- frontends/amiga/gui_options.c | 1 + frontends/amiga/history_local.c | 13 ++++++++----- frontends/amiga/history_local.h | 3 ++- frontends/amiga/plotters.c | 3 +++ frontends/amiga/plotters.h | 3 ++- frontends/amiga/tree.c | 1 + 8 files changed, 18 insertions(+), 9 deletions(-) (limited to 'frontends') diff --git a/frontends/amiga/font_diskfont.c b/frontends/amiga/font_diskfont.c index a64674ba2..313e99255 100644 --- a/frontends/amiga/font_diskfont.c +++ b/frontends/amiga/font_diskfont.c @@ -34,6 +34,7 @@ #include "amiga/font.h" #include "amiga/font_diskfont.h" #include "amiga/gui.h" +#include "amiga/plotters.h" #include "amiga/utf8.h" #define MAX_FONT_NAME_SIZE 33 diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h index 12f25d95d..8289a5c50 100644 --- a/frontends/amiga/gui.h +++ b/frontends/amiga/gui.h @@ -31,7 +31,6 @@ #include "amiga/menu.h" #include "amiga/object.h" #include "amiga/os3support.h" -#include "amiga/plotters.h" #ifdef __amigaos4__ #define HOOKF(ret,func,type,ptr,msgtype) static ret func(struct Hook *hook, type ptr, msgtype msg) @@ -175,7 +174,6 @@ 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); diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c index d700eafeb..f8be3bc6a 100755 --- a/frontends/amiga/gui_options.c +++ b/frontends/amiga/gui_options.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #ifdef __amigaos4__ diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c index 3a6cbe42d..e7171e2b2 100755 --- a/frontends/amiga/history_local.c +++ b/frontends/amiga/history_local.c @@ -53,6 +53,7 @@ #include "amiga/libs.h" #include "amiga/misc.h" #include "amiga/object.h" +#include "amiga/plotters.h" #include "amiga/gui.h" #include "amiga/history_local.h" @@ -80,7 +81,7 @@ static void ami_history_redraw(struct history_window *hw) return; } - glob = &hw->gg; + glob = hw->gg; SetRPAttrs(glob->rp, RPTAG_APenColor, 0xffffffff, TAG_DONE); RectFill(glob->rp, 0, 0, bbox->Width - 1, bbox->Height - 1); @@ -90,10 +91,10 @@ static void ami_history_redraw(struct history_window *hw) glob = &browserglob; - ami_clearclipreg(&hw->gg); + ami_clearclipreg(hw->gg); ami_history_update_extent(hw); - BltBitMapRastPort(hw->gg.bm, 0, 0, hw->win->RPort, + BltBitMapRastPort(hw->gg->bm, 0, 0, hw->win->RPort, bbox->Left, bbox->Top, bbox->Width, bbox->Height, 0x0C0); ami_gui_free_space_box(bbox); @@ -116,8 +117,9 @@ void ami_history_open(struct gui_window *gw) if(!gw->hw) { gw->hw = ami_misc_allocvec_clear(sizeof(struct history_window), 0); + gw->hw->gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0); - ami_init_layers(&gw->hw->gg, scrn->Width, scrn->Height, false); + ami_init_layers(gw->hw->gg, scrn->Width, scrn->Height, false); gw->hw->gw = gw; browser_window_history_size(gw->bw, &width, &height); @@ -223,7 +225,8 @@ static bool ami_history_click(struct history_window *hw, uint16 code) void ami_history_close(struct history_window *hw) { - ami_free_layers(&hw->gg); + ami_free_layers(hw->gg); + FreeVec(hw->gg); hw->gw->hw = NULL; DisposeObject(hw->objects[OID_MAIN]); DelObject(hw->node); diff --git a/frontends/amiga/history_local.h b/frontends/amiga/history_local.h index f7488211c..284da3422 100755 --- a/frontends/amiga/history_local.h +++ b/frontends/amiga/history_local.h @@ -23,6 +23,7 @@ #include struct gui_window; +struct gui_globals; struct history_window { struct nsObject *node; @@ -30,7 +31,7 @@ struct history_window { Object *objects[GID_LAST]; struct gui_window *gw; struct Hook scrollerhook; - struct gui_globals gg; + struct gui_globals *gg; }; /** diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c index fee3e7b08..7e19db7a5 100644 --- a/frontends/amiga/plotters.c +++ b/frontends/amiga/plotters.c @@ -72,6 +72,9 @@ struct bez_point { float y; }; +struct gui_globals browserglob; +struct gui_globals *glob; + static int init_layers_count = 0; static APTR pool_pens = NULL; diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h index 45ebbd0ba..e027189af 100644 --- a/frontends/amiga/plotters.h +++ b/frontends/amiga/plotters.h @@ -45,7 +45,8 @@ struct gui_globals extern const struct plotter_table amiplot; -struct gui_globals *glob; +extern struct gui_globals *glob; +extern struct gui_globals browserglob; void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit); void ami_free_layers(struct gui_globals *gg); diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c index 52d5899c9..7f7140c3a 100644 --- a/frontends/amiga/tree.c +++ b/frontends/amiga/tree.c @@ -73,6 +73,7 @@ #include "amiga/theme.h" /* pointers */ #include "amiga/filetype.h" #include "amiga/schedule.h" +#include "amiga/plotters.h" #define AMI_TREE_MENU_ITEMS 26 #define AMI_TREE_MENU_NEWDIR FULLMENUNUM(1,0,0) -- cgit v1.2.3