summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-12-31 00:37:59 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2016-12-31 00:37:59 +0000
commitd8eec1b048fe7c7cac4a0bd3bb4f31203524ee79 (patch)
treee2a65edcf08f4275e64d39aee411a2705bdb4555
parentd9c8d1c70cac756d47586e2abf2dfbb9a1d96b59 (diff)
downloadnetsurf-d8eec1b048fe7c7cac4a0bd3bb4f31203524ee79.tar.gz
netsurf-d8eec1b048fe7c7cac4a0bd3bb4f31203524ee79.tar.bz2
Update print window to use event callback
-rw-r--r--frontends/amiga/gui.c2
-rw-r--r--frontends/amiga/print.c24
-rwxr-xr-xfrontends/amiga/print.h10
3 files changed, 21 insertions, 15 deletions
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index aea1f7408..82db164bf 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1949,7 +1949,7 @@ static void ami_handle_msg(void)
continue;
}
} else if(node->Type == AMINS_PRINTWINDOW) {
- if(ami_print_event((struct ami_print_window *)w)) {
+ if(w->tbl->event(w)) {
ami_try_quit();
break;
} else {
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 25a4c32f4..5fab0f968 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -96,6 +96,14 @@ struct ami_printer_info
struct Window *win;
};
+struct ami_print_window {
+ struct ami_generic_window w;
+ struct Window *win;
+ Object *objects[OID_LAST];
+ Object *gadgets[GID_LAST];
+ struct hlcache_handle *c;
+};
+
enum
{
PGID_MAIN=0,
@@ -119,6 +127,13 @@ static struct ami_printer_info ami_print_info;
static CONST_STRPTR gadlab[PGID_LAST];
static STRPTR printers[11];
+static BOOL ami_print_event(void *w);
+
+static const struct ami_win_event_table ami_print_table = {
+ ami_print_event,
+ NULL, /* we don't explicitly close the print window on quit (or at all???) */
+};
+
static void ami_print_ui_setup(void)
{
gadlab[PGID_PRINTER] = (char *)ami_utf8_easy((char *)messages_get("Printer"));
@@ -325,22 +340,21 @@ void ami_print_ui(struct hlcache_handle *c)
EndWindow;
pw->win = (struct Window *)RA_OpenWindow(pw->objects[OID_MAIN]);
-
- pw->node = AddObject(window_list, AMINS_PRINTWINDOW);
- pw->node->objstruct = pw;
+ ami_gui_win_list_add(pw, AMINS_PRINTWINDOW, &ami_print_table);
}
static void ami_print_close(struct ami_print_window *pw)
{
DisposeObject(pw->objects[OID_MAIN]);
- DelObject(pw->node);
+ ami_gui_win_list_remove(pw);
ami_print_ui_free();
}
-BOOL ami_print_event(struct ami_print_window *pw)
+static BOOL ami_print_event(void *w)
{
/* return TRUE if window destroyed */
+ struct ami_print_window *pw = (struct ami_print_window *)w;
ULONG result;
uint16 code;
struct hlcache_handle *c;
diff --git a/frontends/amiga/print.h b/frontends/amiga/print.h
index bdd409b50..0d6b4f529 100755
--- a/frontends/amiga/print.h
+++ b/frontends/amiga/print.h
@@ -21,18 +21,10 @@
#include <proto/exec.h>
struct content;
-
-struct ami_print_window {
- struct nsObject *node;
- struct Window *win;
- Object *objects[OID_LAST];
- Object *gadgets[GID_LAST];
- struct hlcache_handle *c;
-};
+struct ami_print_window;
void ami_print(struct hlcache_handle *c, int copies);
void ami_print_ui(struct hlcache_handle *c);
-BOOL ami_print_event(struct ami_print_window *pw);
bool ami_print_cont(void);
struct MsgPort *ami_print_init(void);
void ami_print_free(void);