[project @ 2004-06-29 23:13:40 by rjw]

Experimental hotlist code

svn path=/import/netsurf/; revision=1030
This commit is contained in:
Richard Wilson 2004-06-29 23:13:40 +00:00
parent bc533957fd
commit 4da7fcd8f5
10 changed files with 67 additions and 22 deletions

Binary file not shown.

BIN
!NetSurf/Resources/Sprites,ff9 Executable file

Binary file not shown.

View File

@ -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

View File

@ -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

View File

@ -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 \

View File

@ -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("<NetSurf$Dir>.Resources.Pointers",
e = xosfile_read_stamped_no_path("<NetSurf$Dir>.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("<NetSurf$Dir>.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, "<NetSurf$Dir>.Resources.Pointers");
gui_sprites, "<NetSurf$Dir>.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 &&

View File

@ -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);

View File

@ -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 */

View File

@ -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)); */
}

View File

@ -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) {