RFix immediate menu-related problems; changes to follow

svn path=/trunk/netsurf/; revision=6318
This commit is contained in:
Adrian Lees 2009-01-31 03:43:06 +00:00
parent 6a0a7c346a
commit bce01f90bc
4 changed files with 48 additions and 2 deletions

View File

@ -215,7 +215,7 @@ void ro_gui_menu_init(void)
{ "Object.Object.SaveURL.URI", BROWSER_OBJECT_SAVE_URL_URI, dialog_saveas },
{ "Object.Object.SaveURL.URL", BROWSER_OBJECT_SAVE_URL_URL, dialog_saveas },
{ "Object.Object.SaveURL.LinkText", BROWSER_OBJECT_SAVE_URL_TEXT, dialog_saveas },
{ "_Object.Object.ObjReload", BROWSER_OBJECT_RELOAD, 0 },
{ "Object.Object.ObjReload", BROWSER_OBJECT_RELOAD, 0 },
{ "Object.Link", BROWSER_OBJECT_LINK, 0 },
{ "Object.Link.LinkSave", BROWSER_LINK_SAVE, 0 },
{ "Object.Link.LinkSave.URI", BROWSER_LINK_SAVE_URI, dialog_saveas },

View File

@ -413,6 +413,49 @@ void gui_drag_save_selection(struct selection *s, struct gui_window *g)
}
/**
* Initiates drag saving of a link/URL file
*
* \param save_type format in which URL should be saved
* \param url url to be saved
* \param title title to be included in URI format, if any
* \param g gui window to save from
* \
*/
void ro_gui_drag_save_link(gui_save_type save_type, const char *url,
const char *title, struct gui_window *g)
{
wimp_pointer pointer;
char icon_buf[20];
os_error *error;
/* Close the save window because otherwise we need two contexts
*/
xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
ro_gui_dialog_close(dialog_saveas);
gui_save_url = url;
gui_save_title = title;
gui_save_sourcew = g->window;
saving_from_dialog = false;
error = xwimp_get_pointer_info(&pointer);
if (error) {
LOG(("xwimp_get_pointer_info: 0x%x: %s",
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
return;
}
ro_gui_save_set_state(NULL, save_type, url, save_leafname, icon_buf);
gui_current_drag_type = GUI_DRAG_SAVE;
ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
}
/**
* Start drag of icon under the pointer.
*/

View File

@ -32,6 +32,8 @@ void ro_gui_saveas_quit(void);
void ro_gui_save_prepare(gui_save_type save_type, struct content *c, struct selection *s,
const char *url, const char *title);
void ro_gui_save_start_drag(wimp_pointer *pointer);
void ro_gui_drag_save_link(gui_save_type save_type, const char *url,
const char *title, struct gui_window *g);
void ro_gui_drag_icon(int x, int y, const char *sprite);
void ro_gui_drag_box_cancel(void);
void ro_gui_save_drag_end(wimp_dragged *drag);

View File

@ -2216,6 +2216,7 @@ bool ro_gui_toolbar_click(wimp_pointer *pointer)
case ICON_TOOLBAR_URL:
if (pointer->buttons & (wimp_DRAG_SELECT | wimp_DRAG_ADJUST)) {
if (g->bw->current_content) {
struct content *c = g->bw->current_content;
gui_save_type save_type;
if (ro_gui_shift_pressed())
@ -2223,7 +2224,7 @@ bool ro_gui_toolbar_click(wimp_pointer *pointer)
else
save_type = GUI_SAVE_LINK_TEXT;
gui_drag_save_object(save_type, g->bw->current_content, g);
ro_gui_drag_save_link(save_type, c->url, c->title, g);
}
}
else