From 3f1c2a831536cb4b89db52162460f25ecaf9d4c8 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 17 Jan 2013 18:50:02 +0000 Subject: OS3 needs PBL too --- amiga/Makefile.target | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'amiga/Makefile.target') diff --git a/amiga/Makefile.target b/amiga/Makefile.target index f2c429998..d7abea5cf 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -59,7 +59,7 @@ else LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib ifeq ($(SUBTARGET),os3) - LDFLAGS += -liconv + LDFLAGS += -lpbl -liconv else LDFLAGS += -lauto -lpbl -liconv endif -- cgit v1.2.3 From 18091ec1a9ab94db511ff0c01e590e1a8aa533f9 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 24 Jan 2013 20:00:09 +0000 Subject: Add basic context-sensitive help. --- amiga/Makefile.target | 5 +-- amiga/agclass/amigaguide_class.c | 3 +- amiga/gui.c | 10 ++++++ amiga/gui_options.c | 11 +++++++ amiga/help.c | 66 ++++++++++++++++++++++++++++++++++++++++ amiga/help.h | 36 ++++++++++++++++++++++ 6 files changed, 127 insertions(+), 4 deletions(-) create mode 100755 amiga/help.c create mode 100755 amiga/help.h (limited to 'amiga/Makefile.target') diff --git a/amiga/Makefile.target b/amiga/Makefile.target index d7abea5cf..dc79479c5 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -75,11 +75,12 @@ EXETARGET := NetSurf S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \ thumbnail.c misc.c bitmap.c font.c filetype.c utf8.c login.c \ plotters.c object.c menu.c save_pdf.c arexx.c version.c \ - cookies.c context_menu.c clipboard.c \ + cookies.c context_menu.c clipboard.c help.c font_scan.c \ launch.c search.c history_local.c download.c iff_dr2d.c \ sslcert.c gui_options.c print.c theme.c drag.c icon.c system_colour.c \ datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \ - stringview/stringview.c stringview/urlhistory.c font_scan.c + stringview/stringview.c stringview/urlhistory.c \ + agclass/amigaguide_class.c S_AMIGA := $(addprefix amiga/,$(S_AMIGA)) # This is the final source build list diff --git a/amiga/agclass/amigaguide_class.c b/amiga/agclass/amigaguide_class.c index a4bebd00e..dfac7ad7a 100755 --- a/amiga/agclass/amigaguide_class.c +++ b/amiga/agclass/amigaguide_class.c @@ -4,11 +4,10 @@ * by Daniel "Trixie" Jedlicka */ +#undef __USE_INLINE__ #include "amigaguide_class.h" - - struct localObjectData { struct NewAmigaGuide nag; diff --git a/amiga/gui.c b/amiga/gui.c index 08408b0a8..e544dbd60 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -53,6 +53,7 @@ #include "amiga/font.h" #include "amiga/gui.h" #include "amiga/gui_options.h" +#include "amiga/help.h" #include "amiga/history.h" #include "amiga/history_local.h" #include "amiga/hotlist.h" @@ -385,6 +386,7 @@ void ami_open_resources(void) TAG_DONE))) die(messages_get("NoMemory")); ami_file_req_init(); + ami_help_init(NULL); } void ami_set_options(void) @@ -666,6 +668,8 @@ void ami_openscreen(void) gui_system_colour_finalize(); gui_system_colour_init(); + + ami_help_new_screen(scrn); } void ami_openscreenfirst(void) @@ -1002,6 +1006,7 @@ int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie) else nskey = KEY_TAB; break; case RAWKEY_F5: + case RAWKEY_HELP: // don't translate nskey = keycode; break; @@ -1823,6 +1828,10 @@ void ami_handle_msg(void) if(browser_window_reload_available(gwin->bw)) browser_window_reload(gwin->bw,false); break; + + case RAWKEY_HELP: // help + ami_help_open(AMI_HELP_GUI); + break; } } } @@ -2410,6 +2419,7 @@ void gui_quit(void) FreeSysObject(ASOT_PORT,appport); FreeSysObject(ASOT_PORT,sport); + ami_help_free(); ami_file_req_free(); ami_openurl_close(); diff --git a/amiga/gui_options.c b/amiga/gui_options.c index d2478d67f..7e4cef584 100755 --- a/amiga/gui_options.c +++ b/amiga/gui_options.c @@ -33,6 +33,7 @@ #include "amiga/font.h" #include "amiga/gui.h" #include "amiga/gui_options.h" +#include "amiga/help.h" #include "amiga/theme.h" #include "amiga/utf8.h" #include "utils/messages.h" @@ -1890,6 +1891,16 @@ BOOL ami_gui_opts_event(void) return TRUE; break; + case WMHI_GADGETHELP: + if((result & WMHI_GADGETMASK) == 0) { + /* Pointer not over our window */ + ami_help_open(AMI_HELP_MAIN); + } else { + /* TODO: Make this sensitive to the tab the user is currently on */ + ami_help_open(AMI_HELP_PREFS); + } + break; + case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { diff --git a/amiga/help.c b/amiga/help.c new file mode 100755 index 000000000..214e59d96 --- /dev/null +++ b/amiga/help.c @@ -0,0 +1,66 @@ +/* + * Copyright 2013 Chris Young + * + * 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 . + */ + +#include "amiga/help.h" + +/* AmigaGuide class */ +#include "amiga/agclass/amigaguide_class.h" + +Class *AmigaGuideClass = NULL; +Object *AmigaGuideObject = NULL; + +/* This array needs to match the enum in help.h */ +STRPTR context_nodes[] = { + "Main", + "GUI", + "Prefs", + NULL +}; + +void ami_help_init(struct Screen *screen) +{ + AmigaGuideClass = initAGClass(); + + AmigaGuideObject = NewObject(AmigaGuideClass, NULL, + AMIGAGUIDE_Name, "PROGDIR:NetSurf.guide", + AMIGAGUIDE_BaseName, "NetSurf", + AMIGAGUIDE_Screen, screen, + AMIGAGUIDE_ContextArray, context_nodes, + AMIGAGUIDE_ContextID, AMI_HELP_MAIN, + TAG_DONE); +} + +void ami_help_open(ULONG node) +{ + SetAttrs(AmigaGuideObject, AMIGAGUIDE_ContextID, node, TAG_DONE); + IDoMethod(AmigaGuideObject, AGM_OPEN, NULL); +} + +void ami_help_free(void) +{ + if (AmigaGuideObject) DisposeObject(AmigaGuideObject); + if (AmigaGuideClass) freeAGClass(AmigaGuideClass); + + AmigaGuideObject = NULL; + AmigaGuideClass = NULL; +} + +void ami_help_new_screen(struct Screen *screen) +{ + SetAttrs(AmigaGuideObject, AMIGAGUIDE_Screen, screen, TAG_DONE); +} diff --git a/amiga/help.h b/amiga/help.h new file mode 100755 index 000000000..4baa2a0e2 --- /dev/null +++ b/amiga/help.h @@ -0,0 +1,36 @@ +/* + * Copyright 2013 Chris Young + * + * 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 . + */ + +#ifndef AMIGA_HELP_H +#define AMIGA_HELP_H +#include + +/* This enum needs to match context_array in help.c */ +enum { + AMI_HELP_MAIN, + AMI_HELP_GUI, + AMI_HELP_PREFS, +}; + +struct Screen; + +void ami_help_init(struct Screen *screen); +void ami_help_open(ULONG node); +void ami_help_free(void); +void ami_help_new_screen(struct Screen *screen); +#endif -- cgit v1.2.3