diff --git a/!NetSurf/Resources/Pointers,ff9 b/!NetSurf/Resources/Pointers,ff9 deleted file mode 100644 index d6b9f7b2f..000000000 Binary files a/!NetSurf/Resources/Pointers,ff9 and /dev/null differ diff --git a/!NetSurf/Resources/Sprites,ff9 b/!NetSurf/Resources/Sprites,ff9 new file mode 100755 index 000000000..83c8632a8 Binary files /dev/null and b/!NetSurf/Resources/Sprites,ff9 differ diff --git a/!NetSurf/Resources/en/Messages b/!NetSurf/Resources/en/Messages index 0a19079ed..d6a83f911 100644 --- a/!NetSurf/Resources/en/Messages +++ b/!NetSurf/Resources/en/Messages @@ -56,6 +56,9 @@ WindowSave:Set as default position WindowStagr:Stagger window position WindowSize:Maintain window size WindowReset:Reset default position +Utilities:Utilities +HotlistAdd:Add page to hotlist +HotlistShow:Show hotlist F6 Help:Help HelpContent:Contents F1 HelpGuide:User guide diff --git a/!NetSurf/Resources/fr/Messages b/!NetSurf/Resources/fr/Messages index c063af7e6..c77e98831 100644 --- a/!NetSurf/Resources/fr/Messages +++ b/!NetSurf/Resources/fr/Messages @@ -56,6 +56,9 @@ WindowSave:D WindowStagr:Stagger window position WindowSize:Maintain window size WindowReset:RAZ de la position par défaut +Utilities:Utilities +HotlistAdd:Add page to hotlist +HotlistShow:Show hotlist F6 Help:Aide HelpContent:Contenus F1 HelpGuide:Guide de l'utilisateur diff --git a/makefile b/makefile index a69fb77b5..619645a72 100644 --- a/makefile +++ b/makefile @@ -26,7 +26,7 @@ OBJECTS_RISCOS = $(OBJECTS_COMMON) OBJECTS_RISCOS += browser.o netsurf.o version.o # desktop/ OBJECTS_RISCOS += 401login.o debugwin.o \ dialog.o download.o draw.o filetype.o font.o gif.o \ - gifread.o gui.o help.o history.o htmlinstance.o \ + gifread.o gui.o help.o history.o hotlist.o htmlinstance.o \ htmlredraw.o jpeg.o menus.o mouseactions.o plugin.o \ png.o save.o save_complete.o save_draw.o save_text.o \ schedule.o sprite.o textselection.o theme.o thumbnail.o \ diff --git a/riscos/gui.c b/riscos/gui.c index 2400f992b..d1c3ee24e 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -68,7 +68,7 @@ bool gui_reformat_pending = false; /**< Some windows have been resized, gui_drag_type gui_current_drag_type; wimp_t task_handle; /**< RISC OS wimp task handle. */ static clock_t gui_last_poll; /**< Time of last wimp_poll. */ -osspriteop_area *gui_pointers; /**< Sprite area containing pointer data */ +osspriteop_area *gui_sprites; /**< Sprite area containing pointer and hotlist sprites */ /** Accepted wimp user messages. */ static wimp_MESSAGE_LIST(28) task_messages = { { @@ -214,6 +214,7 @@ void gui_init(int argc, char** argv) ro_gui_history_init(); wimp_close_template(); ro_gui_pointers_init(); + ro_gui_hotlist_init(); ro_gui_icon_bar_create(); ro_gui_check_resolvers(); } @@ -317,7 +318,7 @@ void ro_gui_pointers_init(void) fileswitch_object_type obj_type; os_error *e; - e = xosfile_read_stamped_no_path(".Resources.Pointers", + e = xosfile_read_stamped_no_path(".Resources.Sprites", &obj_type, 0, 0, &len, 0, 0); if (e) { LOG(("xosfile_read_stamped_no_path: 0x%x: %s", @@ -327,17 +328,17 @@ void ro_gui_pointers_init(void) if (obj_type != fileswitch_IS_FILE) die(".Resources.Pointers missing."); - gui_pointers = malloc(len + 4); - if (!gui_pointers) + gui_sprites = malloc(len + 4); + if (!gui_sprites) die("NoMemory"); - gui_pointers->size = len+4; - gui_pointers->sprite_count = 0; - gui_pointers->first = 16; - gui_pointers->used = 16; + gui_sprites->size = len+4; + gui_sprites->sprite_count = 0; + gui_sprites->first = 16; + gui_sprites->used = 16; e = xosspriteop_load_sprite_file(osspriteop_USER_AREA, - gui_pointers, ".Resources.Pointers"); + gui_sprites, ".Resources.Sprites"); if (e) { LOG(("xosspriteop_load_sprite_file: 0x%x: %s", e->errnum, e->errmess)); @@ -386,7 +387,7 @@ void ro_gui_check_resolvers(void) void gui_quit(void) { ro_gui_history_quit(); - free(gui_pointers); + free(gui_sprites); wimp_close_down(task_handle); xhourglass_off(); } @@ -612,6 +613,8 @@ void ro_gui_redraw_window_request(wimp_draw *redraw) ro_gui_redraw_config_th_pane(redraw); else if (redraw->w == history_window) ro_gui_history_redraw(redraw); + else if (redraw->w == hotlist_window) + ro_gui_hotlist_redraw(redraw); else if (redraw->w == dialog_debug) ro_gui_debugwin_redraw(redraw); else { @@ -686,6 +689,8 @@ void ro_gui_mouse_click(wimp_pointer *pointer) ro_gui_icon_bar_click(pointer); else if (pointer->w == history_window) ro_gui_history_click(pointer); + else if (pointer->w == hotlist_window) + ro_gui_hotlist_click(pointer); else if (g && g->type == GUI_BROWSER_WINDOW && g->window == pointer->w) ro_gui_window_click(g, pointer); else if (g && g->type == GUI_BROWSER_WINDOW && diff --git a/riscos/gui.h b/riscos/gui.h index 38fae3396..aec74e4b0 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -26,6 +26,7 @@ extern wimp_w dialog_info, dialog_saveas, dialog_config, dialog_config_br, dialog_objinfo, dialog_tooltip, dialog_warning, dialog_config_th_pane, dialog_debug; extern wimp_w history_window; +extern wimp_w hotlist_window; extern wimp_menu *iconbar_menu, *browser_menu, *combo_menu; extern int iconbar_menu_height; extern struct form_control *current_gadget; @@ -35,7 +36,7 @@ extern bool gui_redraw_debug; extern wimp_menu *current_menu; extern gui_window *current_gui; extern gui_window *ro_gui_current_redraw_gui; -extern osspriteop_area *gui_pointers; +extern osspriteop_area *gui_sprites; typedef enum { GUI_BROWSER_WINDOW } gui_window_type; typedef enum { GUI_SAVE_SOURCE, GUI_SAVE_DRAW, GUI_SAVE_TEXT, @@ -173,6 +174,13 @@ void ro_gui_history_redraw(wimp_draw *redraw); void ro_gui_history_click(wimp_pointer *pointer); void ro_gui_history_mouse_at(wimp_pointer *pointer); +/* in hotlist.c */ +void ro_gui_hotlist_init(void); +void ro_gui_hotlist_show(void); +void ro_gui_hotlist_add(char *title, char *url); +void ro_gui_hotlist_redraw(wimp_draw *redraw); +void ro_gui_hotlist_click(wimp_pointer *pointer); + /* in save.c */ void ro_gui_save_click(wimp_pointer *pointer); void ro_gui_drag_icon(wimp_pointer *pointer); diff --git a/riscos/menus.c b/riscos/menus.c index 8d2226aba..7cf598fc8 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -36,8 +36,8 @@ #define MENU_SELECTION -2 #define MENU_NAVIGATE 2 #define MENU_VIEW 3 -#define MENU_UTILITIES -2 -#define MENU_HELP 4 +#define MENU_UTILITIES 4 +#define MENU_HELP 5 static void translate_menu(wimp_menu *menu); static void ro_gui_menu_prepare_images(void); @@ -232,11 +232,11 @@ static wimp_MENU(2) hotlist_menu = { static wimp_MENU(4) utilities_menu = { { "Utilities" }, 7,2,7,0, 300, 44, 0, { - { wimp_MENU_SEPARATE, (wimp_menu *)&hotlist_menu, DEFAULT_FLAGS, { "Hotlist" } }, - { 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "FindText" } }, + { wimp_MENU_LAST, (wimp_menu *)&hotlist_menu, DEFAULT_FLAGS, { "Hotlist" } }, +/* { 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "FindText" } }, { 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HistLocal" } }, { wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HistGlobal" } } - } +*/ } }; @@ -256,7 +256,7 @@ static wimp_MENU(5) help_menu = { /* Main browser menu */ -static wimp_MENU(5) menu = { +static wimp_MENU(6) menu = { { "NetSurf" }, 7,2,7,0, 200, 44, 0, { { 0, (wimp_menu *)&page_menu, DEFAULT_FLAGS, { "Page" } }, @@ -264,7 +264,7 @@ static wimp_MENU(5) menu = { // { 0, (wimp_menu *)&selection_menu, DEFAULT_FLAGS, { "Selection" } }, { wimp_MENU_GIVE_WARNING, (wimp_menu *)&navigate_menu, DEFAULT_FLAGS, { "Navigate" } }, { 0, (wimp_menu *)&view_menu, DEFAULT_FLAGS, { "View" } }, -// { 0, (wimp_menu *)&utilities_menu, DEFAULT_FLAGS, { "Utilities" } }, + { 0, (wimp_menu *)&utilities_menu, DEFAULT_FLAGS, { "Utilities" } }, { wimp_MENU_LAST | wimp_MENU_GIVE_WARNING, (wimp_menu *)&help_menu, DEFAULT_FLAGS, { "Help" } } } }; @@ -603,6 +603,20 @@ void ro_gui_menu_selection(wimp_selection *selection) break; } break; + case MENU_UTILITIES: + switch (selection->items[1]) { + case 0: /* Hotlist -> */ + switch (selection->items[2]) { + case 0: /* Add to hotlist */ + ro_gui_hotlist_add(current_gui->title, current_gui->url); + break; + case 1: /* Show hotlist */ + ro_gui_hotlist_show(); + break; + } + break; + } + break; case MENU_HELP: switch (selection->items[1]) { case -1: /* No sub-item */ diff --git a/riscos/toolbar.c b/riscos/toolbar.c index 8423c7d6c..d78bca915 100644 --- a/riscos/toolbar.c +++ b/riscos/toolbar.c @@ -70,7 +70,8 @@ static wimp_window empty_window = { 12, 1, {""}, - 0 + 0, + { } }; /* Holder for quick icon creation @@ -127,7 +128,7 @@ struct toolbar *ro_toolbar_create(osspriteop_area *sprite_area, char *url_buffer ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "history", ICON_TOOLBAR_HISTORY)); ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "scale", ICON_TOOLBAR_SCALE)); ro_toolbar_add_icon(toolbar, ro_toolbar_create_separator()); -/* ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "mark", ICON_TOOLBAR_BOOKMARK)); */ + ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "mark", ICON_TOOLBAR_BOOKMARK)); ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "save", ICON_TOOLBAR_SAVE)); /* ro_toolbar_add_icon(toolbar, ro_toolbar_initialise_icon(sprite_area, "print", ICON_TOOLBAR_PRINT)); */ } diff --git a/riscos/window.c b/riscos/window.c index eb6548905..756f52080 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -738,6 +738,13 @@ void ro_gui_toolbar_click(gui_window* g, wimp_pointer* pointer) { xwimp_create_menu((wimp_menu *) dialog_zoom, pointer->pos.x, pointer->pos.y); break; + case ICON_TOOLBAR_BOOKMARK: + if (pointer->buttons == wimp_CLICK_SELECT) { + ro_gui_hotlist_add(g->title, g->url); + } else { + ro_gui_hotlist_show(); + } + break; case ICON_TOOLBAR_SAVE: current_gui = g; @@ -944,6 +951,10 @@ bool ro_gui_window_keypress(gui_window *g, int key, bool toolbar) ro_gui_open_help_page("docs"); return true; + case wimp_KEY_F6: /* Help. */ + ro_gui_hotlist_show(); + return true; + case wimp_KEY_F8: /* View source. */ ro_gui_view_source(content); return true; @@ -1400,7 +1411,7 @@ void gui_window_set_pointer(gui_pointer_shape shape) } else { /* pointer in our own sprite area */ error = xosspriteop_set_pointer_shape(osspriteop_USER_AREA, - gui_pointers, + gui_sprites, (osspriteop_id) entry->sprite_name, 1, entry->xactive, entry->yactive, 0, 0); if (error) {