mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-24 23:39:51 +03:00
More new cache fixing.
svn path=/trunk/netsurf/; revision=10272
This commit is contained in:
parent
4746cb7fe1
commit
c723c8bc59
248
riscos/menus.c
248
riscos/menus.c
@ -104,12 +104,13 @@ static void ro_gui_menu_set_entry_shaded(wimp_menu *menu, menu_action action,
|
|||||||
static void ro_gui_menu_set_entry_ticked(wimp_menu *menu, menu_action action,
|
static void ro_gui_menu_set_entry_ticked(wimp_menu *menu, menu_action action,
|
||||||
bool ticked);
|
bool ticked);
|
||||||
static void ro_gui_menu_get_window_details(wimp_w w, struct gui_window **g,
|
static void ro_gui_menu_get_window_details(wimp_w w, struct gui_window **g,
|
||||||
struct browser_window **bw, struct content **content,
|
struct browser_window **bw, hlcache_handle **h,
|
||||||
struct toolbar **toolbar, struct tree **tree);
|
struct toolbar **toolbar, struct tree **tree);
|
||||||
static int ro_gui_menu_get_checksum(void);
|
static int ro_gui_menu_get_checksum(void);
|
||||||
static bool ro_gui_menu_prepare_url_suggest(void);
|
static bool ro_gui_menu_prepare_url_suggest(void);
|
||||||
static void ro_gui_menu_prepare_pageinfo(struct gui_window *g);
|
static void ro_gui_menu_prepare_pageinfo(struct gui_window *g);
|
||||||
static void ro_gui_menu_prepare_objectinfo(struct content *object, const char *href);
|
static void ro_gui_menu_prepare_objectinfo(hlcache_handle *object,
|
||||||
|
const char *href);
|
||||||
static void ro_gui_menu_refresh_toolbar(struct toolbar *toolbar);
|
static void ro_gui_menu_refresh_toolbar(struct toolbar *toolbar);
|
||||||
static bool ro_gui_menu_translate(struct menu_definition *menu);
|
static bool ro_gui_menu_translate(struct menu_definition *menu);
|
||||||
|
|
||||||
@ -608,7 +609,7 @@ void ro_gui_menu_closed(bool cleanup)
|
|||||||
{
|
{
|
||||||
struct gui_window *g;
|
struct gui_window *g;
|
||||||
struct browser_window *bw;
|
struct browser_window *bw;
|
||||||
struct content *c;
|
hlcache_handle *h;
|
||||||
struct toolbar *t;
|
struct toolbar *t;
|
||||||
struct tree *tree;
|
struct tree *tree;
|
||||||
os_error *error;
|
os_error *error;
|
||||||
@ -622,7 +623,7 @@ void ro_gui_menu_closed(bool cleanup)
|
|||||||
warn_user("MenuError", error->errmess);
|
warn_user("MenuError", error->errmess);
|
||||||
}
|
}
|
||||||
ro_gui_menu_get_window_details(current_menu_window,
|
ro_gui_menu_get_window_details(current_menu_window,
|
||||||
&g, &bw, &c, &t, &tree);
|
&g, &bw, &h, &t, &tree);
|
||||||
current_menu = NULL;
|
current_menu = NULL;
|
||||||
|
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
@ -908,7 +909,7 @@ void ro_gui_prepare_navigate(struct gui_window *gui)
|
|||||||
*/
|
*/
|
||||||
void ro_gui_menu_prepare_pageinfo(struct gui_window *g)
|
void ro_gui_menu_prepare_pageinfo(struct gui_window *g)
|
||||||
{
|
{
|
||||||
struct hlcache_handle *h = g->bw->current_content;
|
hlcache_handle *h = g->bw->current_content;
|
||||||
char icon_buf[20] = "file_xxx";
|
char icon_buf[20] = "file_xxx";
|
||||||
char enc_buf[40];
|
char enc_buf[40];
|
||||||
char enc_token[10] = "Encoding0";
|
char enc_token[10] = "Encoding0";
|
||||||
@ -958,24 +959,26 @@ void ro_gui_menu_prepare_pageinfo(struct gui_window *g)
|
|||||||
* \param object the object for which information is to be displayed
|
* \param object the object for which information is to be displayed
|
||||||
* \param href corresponding href, if any
|
* \param href corresponding href, if any
|
||||||
*/
|
*/
|
||||||
void ro_gui_menu_prepare_objectinfo(struct content *object, const char *href)
|
void ro_gui_menu_prepare_objectinfo(hlcache_handle *object, const char *href)
|
||||||
{
|
{
|
||||||
char icon_buf[20] = "file_xxx";
|
char icon_buf[20] = "file_xxx";
|
||||||
const char *url = "-";
|
const char *url, *mime;
|
||||||
const char *target = "-";
|
const char *target = "-";
|
||||||
const char *mime = "-";
|
|
||||||
|
|
||||||
sprintf(icon_buf, "file_%.3x",
|
sprintf(icon_buf, "file_%.3x",
|
||||||
ro_content_filetype(object));
|
ro_content_filetype(object));
|
||||||
if (!ro_gui_wimp_sprite_exists(icon_buf))
|
if (!ro_gui_wimp_sprite_exists(icon_buf))
|
||||||
sprintf(icon_buf, "file_xxx");
|
sprintf(icon_buf, "file_xxx");
|
||||||
|
|
||||||
if (object->url)
|
url = content_get_url(object);
|
||||||
url = object->url;
|
if (url == NULL)
|
||||||
|
url = "-";
|
||||||
|
mime = content_get_mime_type(object);
|
||||||
|
if (mime == NULL)
|
||||||
|
mime = "-";
|
||||||
|
|
||||||
if (href)
|
if (href)
|
||||||
target = href;
|
target = href;
|
||||||
if (object->mime_type)
|
|
||||||
mime = object->mime_type;
|
|
||||||
|
|
||||||
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_ICON, icon_buf, true);
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_ICON, icon_buf, true);
|
||||||
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_URL, url, true);
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_URL, url, true);
|
||||||
@ -1463,7 +1466,7 @@ bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
|||||||
wimp_window_state state;
|
wimp_window_state state;
|
||||||
struct gui_window *g = NULL;
|
struct gui_window *g = NULL;
|
||||||
struct browser_window *bw = NULL;
|
struct browser_window *bw = NULL;
|
||||||
struct content *c = NULL;
|
hlcache_handle *h = NULL;
|
||||||
struct toolbar *t = NULL;
|
struct toolbar *t = NULL;
|
||||||
struct tree *tree;
|
struct tree *tree;
|
||||||
struct node *node;
|
struct node *node;
|
||||||
@ -1471,7 +1474,7 @@ bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
|||||||
char url[80];
|
char url[80];
|
||||||
const struct url_data *data;
|
const struct url_data *data;
|
||||||
|
|
||||||
ro_gui_menu_get_window_details(owner, &g, &bw, &c, &t, &tree);
|
ro_gui_menu_get_window_details(owner, &g, &bw, &h, &t, &tree);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
|
||||||
@ -1510,17 +1513,19 @@ bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
|||||||
|
|
||||||
/* hotlist actions */
|
/* hotlist actions */
|
||||||
case HOTLIST_ADD_URL:
|
case HOTLIST_ADD_URL:
|
||||||
if ((!hotlist_tree) || (!c) || (!c->url))
|
if ((!hotlist_tree) || (!h) || (!content_get_url(h)))
|
||||||
return false;
|
return false;
|
||||||
data = urldb_get_url_data(c->url);
|
data = urldb_get_url_data(content_get_url(h));
|
||||||
if (data) {
|
if (data) {
|
||||||
node = tree_create_URL_node(hotlist_tree->root, c->url, data, data->title);
|
node = tree_create_URL_node(hotlist_tree->root,
|
||||||
|
content_get_url(h),
|
||||||
|
data, data->title);
|
||||||
if (node) {
|
if (node) {
|
||||||
tree_redraw_area(hotlist_tree,
|
tree_redraw_area(hotlist_tree,
|
||||||
node->box.x - NODE_INSTEP, 0,
|
node->box.x - NODE_INSTEP, 0,
|
||||||
NODE_INSTEP, 16384);
|
NODE_INSTEP, 16384);
|
||||||
tree_handle_node_changed(hotlist_tree, node,
|
tree_handle_node_changed(hotlist_tree,
|
||||||
false, true);
|
node, false, true);
|
||||||
ro_gui_tree_scroll_visible(hotlist_tree,
|
ro_gui_tree_scroll_visible(hotlist_tree,
|
||||||
&node->data);
|
&node->data);
|
||||||
ro_gui_hotlist_save();
|
ro_gui_hotlist_save();
|
||||||
@ -1543,28 +1548,29 @@ bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
|||||||
|
|
||||||
/* page actions */
|
/* page actions */
|
||||||
case BROWSER_PAGE_INFO:
|
case BROWSER_PAGE_INFO:
|
||||||
if (!c)
|
if (!h)
|
||||||
return false;
|
return false;
|
||||||
ro_gui_menu_prepare_action(owner, action, true);
|
ro_gui_menu_prepare_action(owner, action, true);
|
||||||
ro_gui_dialog_open_persistent(g->window,
|
ro_gui_dialog_open_persistent(g->window,
|
||||||
dialog_pageinfo, windows_at_pointer);
|
dialog_pageinfo, windows_at_pointer);
|
||||||
return true;
|
return true;
|
||||||
case BROWSER_PRINT:
|
case BROWSER_PRINT:
|
||||||
if (!c)
|
if (!h)
|
||||||
return false;
|
return false;
|
||||||
ro_gui_menu_prepare_action(owner, action, true);
|
ro_gui_menu_prepare_action(owner, action, true);
|
||||||
ro_gui_dialog_open_persistent(g->window,
|
ro_gui_dialog_open_persistent(g->window,
|
||||||
dialog_print, windows_at_pointer);
|
dialog_print, windows_at_pointer);
|
||||||
return true;
|
return true;
|
||||||
case BROWSER_NEW_WINDOW:
|
case BROWSER_NEW_WINDOW:
|
||||||
if (!c)
|
if (!h)
|
||||||
return false;
|
return false;
|
||||||
browser_window_create(c->url, bw, 0, false, false);
|
browser_window_create(content_get_url(h), bw, 0, false,
|
||||||
|
false);
|
||||||
return true;
|
return true;
|
||||||
case BROWSER_VIEW_SOURCE:
|
case BROWSER_VIEW_SOURCE:
|
||||||
if (!c)
|
if (!h)
|
||||||
return false;
|
return false;
|
||||||
ro_gui_view_source(c);
|
ro_gui_view_source(h);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* object actions */
|
/* object actions */
|
||||||
@ -1595,19 +1601,21 @@ bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
|||||||
case BROWSER_LINK_DOWNLOAD:
|
case BROWSER_LINK_DOWNLOAD:
|
||||||
if (!current_menu_url)
|
if (!current_menu_url)
|
||||||
return false;
|
return false;
|
||||||
browser_window_download(bw, current_menu_url, c->url);
|
browser_window_download(bw, current_menu_url,
|
||||||
|
content_get_url(h));
|
||||||
break;
|
break;
|
||||||
case BROWSER_LINK_NEW_WINDOW:
|
case BROWSER_LINK_NEW_WINDOW:
|
||||||
if (!current_menu_url)
|
if (!current_menu_url)
|
||||||
return false;
|
return false;
|
||||||
browser_window_create(current_menu_url, bw, c->url, true, false);
|
browser_window_create(current_menu_url, bw,
|
||||||
|
content_get_url(h), true, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* save actions */
|
/* save actions */
|
||||||
case BROWSER_OBJECT_SAVE:
|
case BROWSER_OBJECT_SAVE:
|
||||||
case BROWSER_OBJECT_EXPORT_SPRITE:
|
case BROWSER_OBJECT_EXPORT_SPRITE:
|
||||||
case BROWSER_OBJECT_EXPORT_DRAW:
|
case BROWSER_OBJECT_EXPORT_DRAW:
|
||||||
c = current_menu_object;
|
h = current_menu_object;
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
case BROWSER_SAVE:
|
case BROWSER_SAVE:
|
||||||
case BROWSER_SAVE_COMPLETE:
|
case BROWSER_SAVE_COMPLETE:
|
||||||
@ -1617,7 +1625,7 @@ bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
|||||||
case BROWSER_SAVE_URL_URI:
|
case BROWSER_SAVE_URL_URI:
|
||||||
case BROWSER_SAVE_URL_URL:
|
case BROWSER_SAVE_URL_URL:
|
||||||
case BROWSER_SAVE_URL_TEXT:
|
case BROWSER_SAVE_URL_TEXT:
|
||||||
if (!c)
|
if (!h)
|
||||||
return false;
|
return false;
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
case HOTLIST_EXPORT:
|
case HOTLIST_EXPORT:
|
||||||
@ -1675,9 +1683,10 @@ bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
|||||||
history_forward(bw, bw->history);
|
history_forward(bw, bw->history);
|
||||||
return true;
|
return true;
|
||||||
case BROWSER_NAVIGATE_UP:
|
case BROWSER_NAVIGATE_UP:
|
||||||
if ((!bw) || (!c))
|
if ((!bw) || (!h))
|
||||||
return false;
|
return false;
|
||||||
return ro_gui_window_navigate_up(bw->window, c->url);
|
return ro_gui_window_navigate_up(bw->window,
|
||||||
|
content_get_url(h));
|
||||||
case BROWSER_NAVIGATE_RELOAD:
|
case BROWSER_NAVIGATE_RELOAD:
|
||||||
case BROWSER_NAVIGATE_RELOAD_ALL:
|
case BROWSER_NAVIGATE_RELOAD_ALL:
|
||||||
if (!bw)
|
if (!bw)
|
||||||
@ -1698,14 +1707,15 @@ bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
|||||||
|
|
||||||
/* browser window/display actions */
|
/* browser window/display actions */
|
||||||
case BROWSER_SCALE_VIEW:
|
case BROWSER_SCALE_VIEW:
|
||||||
if (!c)
|
if (!h)
|
||||||
return false;
|
return false;
|
||||||
ro_gui_menu_prepare_action(owner, action, true);
|
ro_gui_menu_prepare_action(owner, action, true);
|
||||||
ro_gui_dialog_open_persistent(g->window, dialog_zoom,
|
ro_gui_dialog_open_persistent(g->window, dialog_zoom,
|
||||||
windows_at_pointer);
|
windows_at_pointer);
|
||||||
return true;
|
return true;
|
||||||
case BROWSER_FIND_TEXT:
|
case BROWSER_FIND_TEXT:
|
||||||
if (!c || (c->type != CONTENT_HTML && c->type != CONTENT_TEXTPLAIN))
|
if (!h || (content_get_type(h) != CONTENT_TEXTPLAIN &&
|
||||||
|
content_get_type(h) != CONTENT_HTML))
|
||||||
return false;
|
return false;
|
||||||
ro_gui_menu_prepare_action(owner, action, true);
|
ro_gui_menu_prepare_action(owner, action, true);
|
||||||
ro_gui_dialog_open_persistent(g->window,
|
ro_gui_dialog_open_persistent(g->window,
|
||||||
@ -1881,7 +1891,7 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
struct menu_definition_entry *entry;
|
struct menu_definition_entry *entry;
|
||||||
struct gui_window *g;
|
struct gui_window *g;
|
||||||
struct browser_window *bw;
|
struct browser_window *bw;
|
||||||
struct content *c;
|
hlcache_handle *h;
|
||||||
struct toolbar *t;
|
struct toolbar *t;
|
||||||
struct tree *tree;
|
struct tree *tree;
|
||||||
struct node *node;
|
struct node *node;
|
||||||
@ -1892,10 +1902,10 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
url_func_result res;
|
url_func_result res;
|
||||||
bool compare;
|
bool compare;
|
||||||
|
|
||||||
ro_gui_menu_get_window_details(owner, &g, &bw, &c, &t, &tree);
|
ro_gui_menu_get_window_details(owner, &g, &bw, &h, &t, &tree);
|
||||||
if (current_menu_open)
|
if (current_menu_open)
|
||||||
checksum = ro_gui_menu_get_checksum();
|
checksum = ro_gui_menu_get_checksum();
|
||||||
if (!c) {
|
if (!h) {
|
||||||
current_menu_object = NULL;
|
current_menu_object = NULL;
|
||||||
current_menu_url = NULL;
|
current_menu_url = NULL;
|
||||||
}
|
}
|
||||||
@ -1915,7 +1925,7 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
case HISTORY_SHOW_LOCAL:
|
case HISTORY_SHOW_LOCAL:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu, action,
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
||||||
(!bw || (!bw->history) ||
|
(!bw || (!bw->history) ||
|
||||||
!(c || history_back_available(bw->history) ||
|
!(h || history_back_available(bw->history) ||
|
||||||
history_forward_available(bw->history))));
|
history_forward_available(bw->history))));
|
||||||
break;
|
break;
|
||||||
case HISTORY_SHOW_GLOBAL:
|
case HISTORY_SHOW_GLOBAL:
|
||||||
@ -1926,7 +1936,7 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
/* hotlist actions */
|
/* hotlist actions */
|
||||||
case HOTLIST_ADD_URL:
|
case HOTLIST_ADD_URL:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu, action,
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
||||||
(!c || !hotlist_tree));
|
(!h || !hotlist_tree));
|
||||||
break;
|
break;
|
||||||
case HOTLIST_SHOW:
|
case HOTLIST_SHOW:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu, action,
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
||||||
@ -1952,34 +1962,35 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
/* page actions */
|
/* page actions */
|
||||||
case BROWSER_PAGE:
|
case BROWSER_PAGE:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c || (c->type != CONTENT_HTML &&
|
action, !h ||
|
||||||
c->type != CONTENT_TEXTPLAIN));
|
(content_get_type(h) != CONTENT_HTML &&
|
||||||
|
content_get_type(h) != CONTENT_TEXTPLAIN));
|
||||||
break;
|
break;
|
||||||
case BROWSER_PAGE_INFO:
|
case BROWSER_PAGE_INFO:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((windows) && (c))
|
if ((windows) && (h))
|
||||||
ro_gui_menu_prepare_pageinfo(g);
|
ro_gui_menu_prepare_pageinfo(g);
|
||||||
break;
|
break;
|
||||||
case BROWSER_PRINT:
|
case BROWSER_PRINT:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((t) && (t->type == THEME_BROWSER_TOOLBAR))
|
if ((t) && (t->type == THEME_BROWSER_TOOLBAR))
|
||||||
ro_gui_set_icon_shaded_state(
|
ro_gui_set_icon_shaded_state(
|
||||||
t->toolbar_handle,
|
t->toolbar_handle,
|
||||||
ICON_TOOLBAR_PRINT, !c);
|
ICON_TOOLBAR_PRINT, !h);
|
||||||
if ((windows) && (c))
|
if ((windows) && (h))
|
||||||
ro_gui_print_prepare(g);
|
ro_gui_print_prepare(g);
|
||||||
if ((t) && (!t->editor) &&
|
if ((t) && (!t->editor) &&
|
||||||
(t->type == THEME_BROWSER_TOOLBAR))
|
(t->type == THEME_BROWSER_TOOLBAR))
|
||||||
ro_gui_set_icon_shaded_state(
|
ro_gui_set_icon_shaded_state(
|
||||||
t->toolbar_handle,
|
t->toolbar_handle,
|
||||||
ICON_TOOLBAR_PRINT, !c);
|
ICON_TOOLBAR_PRINT, !h);
|
||||||
break;
|
break;
|
||||||
case BROWSER_NEW_WINDOW:
|
case BROWSER_NEW_WINDOW:
|
||||||
case BROWSER_VIEW_SOURCE:
|
case BROWSER_VIEW_SOURCE:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* object actions */
|
/* object actions */
|
||||||
@ -2024,10 +2035,10 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
bool exp_draw = false;
|
bool exp_draw = false;
|
||||||
|
|
||||||
if (current_menu_object)
|
if (current_menu_object)
|
||||||
c = current_menu_object;
|
h = current_menu_object;
|
||||||
|
|
||||||
if (c) {
|
if (h) {
|
||||||
switch (c->type) {
|
switch (content_get_type(h)) {
|
||||||
/* \todo - this classification should prob be done in content_() */
|
/* \todo - this classification should prob be done in content_() */
|
||||||
/* bitmap types (Sprite export possible) */
|
/* bitmap types (Sprite export possible) */
|
||||||
#ifdef WITH_JPEG
|
#ifdef WITH_JPEG
|
||||||
@ -2068,15 +2079,24 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case BROWSER_OBJECT_EXPORT_SPRITE: if (!exp_sprite) c = NULL; break;
|
case BROWSER_OBJECT_EXPORT_SPRITE:
|
||||||
case BROWSER_OBJECT_EXPORT_DRAW: if (!exp_draw) c = NULL; break;
|
if (!exp_sprite)
|
||||||
default: if (!exp_sprite && !exp_draw) c = NULL; break;
|
h = NULL;
|
||||||
|
break;
|
||||||
|
case BROWSER_OBJECT_EXPORT_DRAW:
|
||||||
|
if (!exp_draw)
|
||||||
|
h = NULL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (!exp_sprite && !exp_draw)
|
||||||
|
h = NULL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE, c, NULL, NULL, NULL);
|
ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE, h, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BROWSER_LINK_SAVE_URI:
|
case BROWSER_LINK_SAVE_URI:
|
||||||
@ -2103,94 +2123,104 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BROWSER_SELECTION:
|
case BROWSER_SELECTION:
|
||||||
/* make menu available if there's anything that /could/ be selected */
|
/* make menu available if there's anything that /could/
|
||||||
|
* be selected */
|
||||||
ro_gui_menu_set_entry_shaded(current_menu, action,
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
||||||
!c || (c->type != CONTENT_HTML && c->type != CONTENT_TEXTPLAIN));
|
!h || (content_get_type(h) != CONTENT_HTML &&
|
||||||
|
content_get_type(h) != CONTENT_TEXTPLAIN));
|
||||||
break;
|
break;
|
||||||
case BROWSER_SELECTION_SAVE:
|
case BROWSER_SELECTION_SAVE:
|
||||||
if (c && (!bw->sel || !selection_defined(bw->sel))) c = NULL;
|
if (h && (!bw->sel || !selection_defined(bw->sel)))
|
||||||
ro_gui_menu_set_entry_shaded(current_menu, action, !c);
|
h = NULL;
|
||||||
if ((c) && (windows))
|
ro_gui_menu_set_entry_shaded(current_menu, action, !h);
|
||||||
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_TEXT_SELECTION, NULL, bw->sel, NULL, NULL);
|
ro_gui_save_prepare(GUI_SAVE_TEXT_SELECTION, NULL, bw->sel, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
case BROWSER_SELECTION_COPY:
|
case BROWSER_SELECTION_COPY:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu, action,
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
||||||
!(c && bw->sel && selection_defined(bw->sel)));
|
!(h && bw->sel && selection_defined(bw->sel)));
|
||||||
break;
|
break;
|
||||||
case BROWSER_SELECTION_CUT:
|
case BROWSER_SELECTION_CUT:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu, action,
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
||||||
!(c && bw->sel && selection_defined(bw->sel)
|
!(h && bw->sel && selection_defined(bw->sel)
|
||||||
&& !selection_read_only(bw->sel)));
|
&& !selection_read_only(bw->sel)));
|
||||||
break;
|
break;
|
||||||
case BROWSER_SELECTION_PASTE:
|
case BROWSER_SELECTION_PASTE:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu, action, !(c && bw->paste_callback));
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
||||||
|
!(h && bw->paste_callback));
|
||||||
break;
|
break;
|
||||||
case BROWSER_SAVE:
|
case BROWSER_SAVE:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_SOURCE, c, NULL, NULL, NULL);
|
ro_gui_save_prepare(GUI_SAVE_SOURCE, h, NULL, NULL, NULL);
|
||||||
if ((t) && (!t->editor) &&
|
if ((t) && (!t->editor) &&
|
||||||
(t->type == THEME_BROWSER_TOOLBAR))
|
(t->type == THEME_BROWSER_TOOLBAR))
|
||||||
ro_gui_set_icon_shaded_state(
|
ro_gui_set_icon_shaded_state(
|
||||||
t->toolbar_handle,
|
t->toolbar_handle,
|
||||||
ICON_TOOLBAR_SAVE, !c);
|
ICON_TOOLBAR_SAVE, !h);
|
||||||
break;
|
break;
|
||||||
case BROWSER_SAVE_COMPLETE:
|
case BROWSER_SAVE_COMPLETE:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_COMPLETE, c, NULL, NULL, NULL);
|
ro_gui_save_prepare(GUI_SAVE_COMPLETE, h, NULL, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
case BROWSER_EXPORT_DRAW:
|
case BROWSER_EXPORT_DRAW:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_DRAW, c, NULL, NULL, NULL);
|
ro_gui_save_prepare(GUI_SAVE_DRAW, h, NULL, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
case BROWSER_EXPORT_PDF:
|
case BROWSER_EXPORT_PDF:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_PDF, c, NULL, NULL, NULL);
|
ro_gui_save_prepare(GUI_SAVE_PDF, h, NULL, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
case BROWSER_EXPORT_TEXT:
|
case BROWSER_EXPORT_TEXT:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_TEXT, c, NULL, NULL, NULL);
|
ro_gui_save_prepare(GUI_SAVE_TEXT, h, NULL, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
case BROWSER_OBJECT_SAVE_URL_URI:
|
case BROWSER_OBJECT_SAVE_URL_URI:
|
||||||
if (c && c->type == CONTENT_HTML)
|
if (h && content_get_type(h) == CONTENT_HTML)
|
||||||
c = current_menu_object;
|
h = current_menu_object;
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
case BROWSER_SAVE_URL_URI:
|
case BROWSER_SAVE_URL_URI:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL, NULL,
|
ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL,
|
||||||
c->url, c->title);
|
NULL,
|
||||||
|
content_get_url(h),
|
||||||
|
content_get_title(h));
|
||||||
break;
|
break;
|
||||||
case BROWSER_OBJECT_SAVE_URL_URL:
|
case BROWSER_OBJECT_SAVE_URL_URL:
|
||||||
if (c && c->type == CONTENT_HTML)
|
if (h && content_get_type(h) == CONTENT_HTML)
|
||||||
c = current_menu_object;
|
h = current_menu_object;
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
case BROWSER_SAVE_URL_URL:
|
case BROWSER_SAVE_URL_URL:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL,
|
ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL,
|
||||||
c->url, c->title);
|
NULL,
|
||||||
|
content_get_url(h),
|
||||||
|
content_get_title(h));
|
||||||
break;
|
break;
|
||||||
case BROWSER_OBJECT_SAVE_URL_TEXT:
|
case BROWSER_OBJECT_SAVE_URL_TEXT:
|
||||||
c = current_menu_object;
|
h = current_menu_object;
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
case BROWSER_SAVE_URL_TEXT:
|
case BROWSER_SAVE_URL_TEXT:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL, NULL,
|
ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL,
|
||||||
c->url, c->title);
|
NULL,
|
||||||
|
content_get_url(h),
|
||||||
|
content_get_title(h));
|
||||||
break;
|
break;
|
||||||
case HOTLIST_EXPORT:
|
case HOTLIST_EXPORT:
|
||||||
if ((tree) && (windows))
|
if ((tree) && (windows))
|
||||||
@ -2225,12 +2255,13 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
ICON_TOOLBAR_FORWARD, !result);
|
ICON_TOOLBAR_FORWARD, !result);
|
||||||
break;
|
break;
|
||||||
case BROWSER_NAVIGATE_UP:
|
case BROWSER_NAVIGATE_UP:
|
||||||
result = (bw && c);
|
result = (bw && h);
|
||||||
if (result) {
|
if (result) {
|
||||||
res = url_parent(c->url, &parent);
|
res = url_parent(content_get_url(h), &parent);
|
||||||
if (res == URL_FUNC_OK) {
|
if (res == URL_FUNC_OK) {
|
||||||
res = url_compare(c->url, parent,
|
res = url_compare(content_get_url(h),
|
||||||
false, &compare);
|
parent, false,
|
||||||
|
&compare);
|
||||||
if (res == URL_FUNC_OK)
|
if (res == URL_FUNC_OK)
|
||||||
result = !compare;
|
result = !compare;
|
||||||
free(parent);
|
free(parent);
|
||||||
@ -2275,17 +2306,18 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
/* display actions */
|
/* display actions */
|
||||||
case BROWSER_SCALE_VIEW:
|
case BROWSER_SCALE_VIEW:
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, !c);
|
action, !h);
|
||||||
if ((c) && (windows))
|
if ((h) && (windows))
|
||||||
ro_gui_dialog_prepare_zoom(g);
|
ro_gui_dialog_prepare_zoom(g);
|
||||||
if ((t) && (!t->editor) &&
|
if ((t) && (!t->editor) &&
|
||||||
(t->type == THEME_BROWSER_TOOLBAR))
|
(t->type == THEME_BROWSER_TOOLBAR))
|
||||||
ro_gui_set_icon_shaded_state(
|
ro_gui_set_icon_shaded_state(
|
||||||
t->toolbar_handle,
|
t->toolbar_handle,
|
||||||
ICON_TOOLBAR_SCALE, !c);
|
ICON_TOOLBAR_SCALE, !h);
|
||||||
break;
|
break;
|
||||||
case BROWSER_FIND_TEXT:
|
case BROWSER_FIND_TEXT:
|
||||||
result = !c || (c->type != CONTENT_HTML && c->type != CONTENT_TEXTPLAIN);
|
result = !h || (content_get_type(h) != CONTENT_HTML &&
|
||||||
|
content_get_type(h) != CONTENT_TEXTPLAIN);
|
||||||
ro_gui_menu_set_entry_shaded(current_menu,
|
ro_gui_menu_set_entry_shaded(current_menu,
|
||||||
action, result);
|
action, result);
|
||||||
if ((!result) && (windows)) {
|
if ((!result) && (windows)) {
|
||||||
@ -2469,7 +2501,7 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|||||||
* \param w the window to complete information for
|
* \param w the window to complete information for
|
||||||
*/
|
*/
|
||||||
void ro_gui_menu_get_window_details(wimp_w w, struct gui_window **g,
|
void ro_gui_menu_get_window_details(wimp_w w, struct gui_window **g,
|
||||||
struct browser_window **bw, struct content **content,
|
struct browser_window **bw, hlcache_handle **h,
|
||||||
struct toolbar **toolbar, struct tree **tree)
|
struct toolbar **toolbar, struct tree **tree)
|
||||||
{
|
{
|
||||||
*g = ro_gui_window_lookup(w);
|
*g = ro_gui_window_lookup(w);
|
||||||
@ -2477,11 +2509,11 @@ void ro_gui_menu_get_window_details(wimp_w w, struct gui_window **g,
|
|||||||
*bw = (*g)->bw;
|
*bw = (*g)->bw;
|
||||||
*toolbar = (*g)->toolbar;
|
*toolbar = (*g)->toolbar;
|
||||||
if (*bw)
|
if (*bw)
|
||||||
*content = (*bw)->current_content;
|
*h = (*bw)->current_content;
|
||||||
*tree = NULL;
|
*tree = NULL;
|
||||||
} else {
|
} else {
|
||||||
*bw = NULL;
|
*bw = NULL;
|
||||||
*content = NULL;
|
*h = NULL;
|
||||||
if ((hotlist_tree) && (w == (wimp_w)hotlist_tree->handle))
|
if ((hotlist_tree) && (w == (wimp_w)hotlist_tree->handle))
|
||||||
*tree = hotlist_tree;
|
*tree = hotlist_tree;
|
||||||
else if ((global_history_tree) &&
|
else if ((global_history_tree) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user