summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--!NetSurf/Resources/en/Messages1
-rw-r--r--!NetSurf/Resources/en/Templates,fecbin7203 -> 7203 bytes
-rw-r--r--!NetSurf/Resources/fr/Messages1
-rw-r--r--!NetSurf/Resources/fr/Templates,fecbin7282 -> 7282 bytes
-rw-r--r--riscos/dialog.c81
-rw-r--r--riscos/gui.c4
-rw-r--r--riscos/gui.h3
-rw-r--r--riscos/menus.c25
-rw-r--r--riscos/save.c11
-rw-r--r--riscos/window.c18
10 files changed, 123 insertions, 21 deletions
diff --git a/!NetSurf/Resources/en/Messages b/!NetSurf/Resources/en/Messages
index f43dcd8ef..b191d3b20 100644
--- a/!NetSurf/Resources/en/Messages
+++ b/!NetSurf/Resources/en/Messages
@@ -132,6 +132,7 @@ MiscError:An unexpected error occurred:
FileError:File does not exist:
HotlistSaveError:The hotlist was unable to be correctly saved.
HotlistLoadError:The hotlist was unable to be correctly loaded.
+NoPathError:To save, drag the icon to a directory display
# Some general purpose words and phrases
Bytes: B
diff --git a/!NetSurf/Resources/en/Templates,fec b/!NetSurf/Resources/en/Templates,fec
index 54bfa5712..0f84a755f 100644
--- a/!NetSurf/Resources/en/Templates,fec
+++ b/!NetSurf/Resources/en/Templates,fec
Binary files differ
diff --git a/!NetSurf/Resources/fr/Messages b/!NetSurf/Resources/fr/Messages
index a74c3a338..cb794de0b 100644
--- a/!NetSurf/Resources/fr/Messages
+++ b/!NetSurf/Resources/fr/Messages
@@ -132,6 +132,7 @@ MiscError:Une erreur inattendue s'est produite:
FileError:Le fichier n'existe pas:
HotlistSaveError:The hotlist was unable to be correctly saved.
HotlistLoadError:The hotlist was unable to be correctly loaded.
+NoPathError:To save, drag the icon to a directory display
# Some general purpose words and phrases
Bytes: O
diff --git a/!NetSurf/Resources/fr/Templates,fec b/!NetSurf/Resources/fr/Templates,fec
index 5025b10e3..31322b1bb 100644
--- a/!NetSurf/Resources/fr/Templates,fec
+++ b/!NetSurf/Resources/fr/Templates,fec
Binary files differ
diff --git a/riscos/dialog.c b/riscos/dialog.c
index a33d5fd1a..7e7c96c8b 100644
--- a/riscos/dialog.c
+++ b/riscos/dialog.c
@@ -26,6 +26,10 @@
#include "netsurf/utils/messages.h"
#include "netsurf/utils/utils.h"
+/* The maximum number of persistant dialogues
+*/
+#define MAX_PERSISTANT 8
+
wimp_w dialog_info, dialog_saveas, dialog_config, dialog_config_br,
dialog_config_prox, dialog_config_th, download_template,
#ifdef WITH_AUTH
@@ -40,6 +44,9 @@ static char *theme_choice = 0;
static struct theme_entry *theme_list = 0;
static unsigned int theme_list_entries = 0;
+/* A simple mapping of parent and child
+*/
+static wimp_w persistant_dialog[MAX_PERSISTANT][1];
static void ro_gui_dialog_click_config(wimp_pointer *pointer);
static void ro_gui_dialog_click_config_br(wimp_pointer *pointer);
@@ -183,7 +190,6 @@ wimp_window * ro_gui_dialog_load_template(const char *template_name)
/**
* Open a dialog box, centered on the screen.
*/
-
void ro_gui_dialog_open(wimp_w w)
{
int screen_x, screen_y, dx, dy;
@@ -207,6 +213,79 @@ void ro_gui_dialog_open(wimp_w w)
wimp_open_window((wimp_open *) &open);
}
+
+/**
+ * Open a persistant dialog box relative to the pointer.
+ *
+ * \param parent the owning window (NULL for no owner)
+ * \param w the dialog window
+ */
+void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w) {
+ int dx, dy, i;
+ wimp_pointer pointer;
+ wimp_window_state open;
+ os_error *error;
+
+ /* Get the pointer position
+ */
+ error = xwimp_get_pointer_info(&pointer);
+ if (error) {
+ LOG(("xwimp_get_pointer_info: 0x%x: %s\n",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+
+ /* Move and open
+ */
+ open.w = w;
+ wimp_get_window_state(&open);
+ dx = (open.visible.x1 - open.visible.x0);
+ dy = (open.visible.y1 - open.visible.y0);
+ open.visible.x0 = pointer.pos.x - 64;
+ open.visible.x1 = pointer.pos.x - 64 + dx;
+ open.visible.y0 = pointer.pos.y - dy;
+ open.visible.y1 = pointer.pos.y;
+ open.next = wimp_TOP;
+ wimp_open_window((wimp_open *) &open);
+
+ /* Add a mapping
+ */
+ if (parent == NULL) return;
+ for (i = 0; i < MAX_PERSISTANT; i++) {
+ if ((persistant_dialog[i][0] == NULL) || (persistant_dialog[i][0] == w)) {
+ persistant_dialog[i][0] = w;
+ persistant_dialog[i][1] = parent;
+ return;
+ }
+ }
+
+ /* Log that we failed to create a mapping
+ */
+ LOG(("Unable to map persistant dialog to parent."));
+}
+
+
+/**
+ * Open a persistant dialog box relative to the pointer.
+ *
+ * \param parent the window to close children of
+ */
+void ro_gui_dialog_close_persistant(wimp_w parent) {
+ int i;
+
+ /* Check our mappings
+ */
+ if (parent == NULL) return;
+ for (i = 0; i < MAX_PERSISTANT; i++) {
+ if (persistant_dialog[i][1] == parent) {
+ xwimp_close_window(persistant_dialog[i][0]);
+ persistant_dialog[i][0] = NULL;
+ }
+ }
+}
+
+
/**
* Handle key presses in one of the dialog boxes.
*/
diff --git a/riscos/gui.c b/riscos/gui.c
index 28634412e..b6737aa9b 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -666,6 +666,10 @@ void ro_gui_close_window_request(wimp_close *close)
{
gui_window *g;
struct gui_download_window *dw;
+
+ /* Check for children
+ */
+ ro_gui_dialog_close_persistant(close->w);
if (close->w == dialog_debug)
ro_gui_debugwin_close();
diff --git a/riscos/gui.h b/riscos/gui.h
index 3df53141e..7bace115c 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -111,12 +111,15 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning);
void ro_gui_prepare_navigate(gui_window *gui);
void ro_gui_menu_prepare_save(struct content *c);
void ro_gui_menu_prepare_scale(void);
+void ro_gui_menu_prepare_pageinfo(void);
/* in dialog.c */
void ro_gui_dialog_init(void);
wimp_w ro_gui_dialog_create(const char *template_name);
wimp_window * ro_gui_dialog_load_template(const char *template_name);
void ro_gui_dialog_open(wimp_w w);
+void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w);
+void ro_gui_dialog_close_persistant(wimp_w parent);
void ro_gui_dialog_click(wimp_pointer *pointer);
void ro_gui_save_options(void);
bool ro_gui_dialog_keypress(wimp_key *key);
diff --git a/riscos/menus.c b/riscos/menus.c
index 9d465b9ef..eeb02e913 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -45,7 +45,6 @@ static void ro_gui_menu_prepare_images(void);
static void ro_gui_menu_prepare_window(void);
static void ro_gui_menu_prepare_toolbars(void);
static void ro_gui_menu_prepare_help(int forced);
-static void ro_gui_menu_pageinfo(wimp_message_menu_warning *warning);
static void ro_gui_menu_objectinfo(wimp_message_menu_warning *warning);
static struct box *ro_gui_menu_find_object_box(void);
static void ro_gui_menu_object_reload(void);
@@ -867,7 +866,13 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning)
case 0: /* Page info */
- ro_gui_menu_pageinfo(warning);
+ ro_gui_menu_prepare_pageinfo();
+ error = xwimp_create_sub_menu((wimp_menu *) dialog_pageinfo,
+ warning->pos.x, warning->pos.y);
+ if (error) {
+ LOG(("0x%x: %s\n", error->errnum, error->errmess));
+ warn_user("MenuError", error->errmess);
+ }
return;
case 1:
@@ -1336,10 +1341,9 @@ void ro_gui_menu_prepare_help(int forced) {
}
}
-void ro_gui_menu_pageinfo(wimp_message_menu_warning *warning)
+void ro_gui_menu_prepare_pageinfo(void)
{
struct content *c = current_gui->data.browser.bw->current_content;
- os_error *error;
char icon_buf[20] = "file_xxx";
const char *icon = icon_buf;
const char *title = "-";
@@ -1353,6 +1357,12 @@ void ro_gui_menu_pageinfo(wimp_message_menu_warning *warning)
sprintf(icon_buf, "file_%x", ro_content_filetype(c));
+ /* Ensure the correct icon exists
+ */
+ if (xwimpspriteop_read_sprite_info(icon_buf, 0, 0, 0, 0)) {
+ sprintf(icon_buf, "file_xxx");
+ }
+
if (c->type == CONTENT_HTML && c->data.html.encoding != NULL) {
enc = c->data.html.encoding;
}
@@ -1362,13 +1372,6 @@ void ro_gui_menu_pageinfo(wimp_message_menu_warning *warning)
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_URL, url);
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_ENC, enc);
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_TYPE, mime);
-
- error = xwimp_create_sub_menu((wimp_menu *) dialog_pageinfo,
- warning->pos.x, warning->pos.y);
- if (error) {
- LOG(("0x%x: %s\n", error->errnum, error->errmess));
- warn_user("MenuError", error->errmess);
- }
}
void ro_gui_menu_objectinfo(wimp_message_menu_warning *warning)
diff --git a/riscos/save.c b/riscos/save.c
index 0d4f290a7..e085d36e4 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -47,6 +47,17 @@ static bool ro_gui_save_link(struct content *c, link_format format, char *path);
void ro_gui_save_click(wimp_pointer *pointer)
{
switch (pointer->i) {
+ case ICON_SAVE_OK:
+ /* Todo: Try save, and report error NoPathError if needed */
+ break;
+ case ICON_SAVE_CANCEL:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ xwimp_close_window(pointer->w);
+ xwimp_create_menu((wimp_menu *)-1, 0, 0);
+ } else if (pointer->buttons == wimp_CLICK_ADJUST) {
+ ro_gui_menu_prepare_save(save_content);
+ }
+ break;
case ICON_SAVE_ICON:
if (pointer->buttons == wimp_DRAG_SELECT) {
gui_current_drag_type = GUI_DRAG_SAVE;
diff --git a/riscos/window.c b/riscos/window.c
index 59cbb8c03..3609c9a40 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -949,6 +949,11 @@ bool ro_gui_window_keypress(gui_window *g, int key, bool toolbar)
}
switch (key) {
+ case wimp_KEY_CONTROL + wimp_KEY_F1:
+ current_gui = g;
+ ro_gui_menu_prepare_pageinfo();
+ ro_gui_dialog_open_persistant(g->window, dialog_pageinfo);
+ return true;
case wimp_KEY_F1: /* Help. */
ro_gui_open_help_page("docs");
return true;
@@ -996,33 +1001,28 @@ bool ro_gui_window_keypress(gui_window *g, int key, bool toolbar)
current_gui = g;
gui_current_save_type = GUI_SAVE_SOURCE;
ro_gui_menu_prepare_save(content);
- /** \todo make save window persistent */
- xwimp_create_menu((wimp_menu *) dialog_saveas,
- pointer.pos.x, pointer.pos.y);
+ ro_gui_dialog_open_persistant(g->window, dialog_saveas);
return true;
case wimp_KEY_CONTROL + wimp_KEY_F3:
current_gui = g;
gui_current_save_type = GUI_SAVE_TEXT;
ro_gui_menu_prepare_save(content);
- xwimp_create_menu((wimp_menu *) dialog_saveas,
- pointer.pos.x, pointer.pos.y);
+ ro_gui_dialog_open_persistant(g->window, dialog_saveas);
return true;
case wimp_KEY_SHIFT + wimp_KEY_F3:
current_gui = g;
gui_current_save_type = GUI_SAVE_COMPLETE;
ro_gui_menu_prepare_save(content);
- xwimp_create_menu((wimp_menu *) dialog_saveas,
- pointer.pos.x, pointer.pos.y);
+ ro_gui_dialog_open_persistant(g->window, dialog_saveas);
return true;
case wimp_KEY_CONTROL + wimp_KEY_SHIFT + wimp_KEY_F3:
current_gui = g;
gui_current_save_type = GUI_SAVE_DRAW;
ro_gui_menu_prepare_save(content);
- xwimp_create_menu((wimp_menu *) dialog_saveas,
- pointer.pos.x, pointer.pos.y);
+ ro_gui_dialog_open_persistant(g->window, dialog_saveas);
return true;
case wimp_KEY_RETURN: