summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--riscos/dialog.c33
-rw-r--r--riscos/menus.c79
-rw-r--r--riscos/save.c4
3 files changed, 74 insertions, 42 deletions
diff --git a/riscos/dialog.c b/riscos/dialog.c
index 395bbcdc7..4823e7b5a 100644
--- a/riscos/dialog.c
+++ b/riscos/dialog.c
@@ -289,8 +289,8 @@ void ro_gui_dialog_close_persistant(wimp_w parent) {
*/
if (parent == NULL) return;
for (i = 0; i < MAX_PERSISTANT; i++) {
- if (persistant_dialog[i][1] == parent) {
- xwimp_close_window(persistant_dialog[i][0]);
+ if ((persistant_dialog[i][1] == parent) && (persistant_dialog[i][0] != NULL)) {
+ ro_gui_dialog_close(persistant_dialog[i][0]);
persistant_dialog[i][0] = NULL;
}
}
@@ -802,7 +802,33 @@ void ro_gui_dialog_click_warning(wimp_pointer *pointer)
void ro_gui_dialog_close(wimp_w close)
{
- os_error *error;
+ int i;
+ wimp_caret caret;
+ os_error *error = NULL;
+
+ /* Give the caret back to the parent window. This code relies on the fact that
+ only hotlist windows and browser windows open persistant dialogues, as the caret
+ gets placed to no icon.
+ */
+ if (!xwimp_get_caret_position(&caret)) {
+ if (caret.w == close) {
+
+ /* Check if we are a persistant window
+ */
+ for (i = 0; i < MAX_PERSISTANT; i++) {
+ if (persistant_dialog[i][0] == close) {
+ persistant_dialog[i][0] = NULL;
+ error = xwimp_set_caret_position(persistant_dialog[i][1],
+ wimp_ICON_WINDOW, -100, -100, 32, -1);
+ }
+ }
+ }
+ if (error) {
+ LOG(("xwimp_set_caret_position: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ }
+ }
error = xwimp_close_window(close);
if (error) {
@@ -827,6 +853,7 @@ void ro_gui_dialog_close(wimp_w close)
return;
}
}
+
}
diff --git a/riscos/menus.c b/riscos/menus.c
index 8ccfe39ef..87a9024d7 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -207,13 +207,12 @@ static wimp_MENU(4) window_menu = {
/* View submenu
*/
-static wimp_MENU(5) view_menu = {
+static wimp_MENU(4) view_menu = {
{ "View" }, 7,2,7,0, 300, 44, 0,
{
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "ScaleView" } },
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)&image_menu, DEFAULT_FLAGS, { "Images" } },
- { wimp_MENU_GIVE_WARNING, (wimp_menu *)&toolbar_menu, DEFAULT_FLAGS, { "Toolbars" } },
- { wimp_MENU_GIVE_WARNING | wimp_MENU_SEPARATE, (wimp_menu *)&window_menu, DEFAULT_FLAGS, { "Window" } },
+ { wimp_MENU_GIVE_WARNING | wimp_MENU_SEPARATE, (wimp_menu *)&toolbar_menu, DEFAULT_FLAGS, { "Toolbars" } },
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "OptDefault" } }
}
};
@@ -232,10 +231,11 @@ static wimp_MENU(2) hotlist_util_menu = {
/* Utilities submenu
*/
-static wimp_MENU(4) utilities_menu = {
+static wimp_MENU(2) utilities_menu = {
{ "Utilities" }, 7,2,7,0, 300, 44, 0,
{
- { wimp_MENU_LAST, (wimp_menu *)&hotlist_util_menu, DEFAULT_FLAGS, { "Hotlist" } },
+ { 0, (wimp_menu *)&hotlist_util_menu, DEFAULT_FLAGS, { "Hotlist" } },
+ { wimp_MENU_GIVE_WARNING | wimp_MENU_LAST, (wimp_menu *)&window_menu, DEFAULT_FLAGS, { "Window" } },
/* { 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" } }
@@ -474,14 +474,14 @@ void ro_gui_create_menu(wimp_menu *menu, int x, int y, gui_window *g)
current_menu_y = y;
current_gui = g;
if (menu == browser_menu) {
- if (!hotlist_window) browser_utilities_menu->entries[0].icon_flags |= wimp_ICON_SHADED;
+ if (!hotlist_window) browser_utilities_menu->entries[0].icon_flags |= wimp_ICON_SHADED;
if (ro_gui_menu_find_object_box())
menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
else
menu->entries[1].icon_flags |= wimp_ICON_SHADED;
}
if (menu == hotlist_menu) {
- ro_gui_menu_prepare_hotlist();
+ ro_gui_menu_prepare_hotlist();
}
wimp_create_menu(menu, x, y);
}
@@ -726,7 +726,26 @@ void ro_gui_menu_selection(wimp_selection *selection)
}
ro_gui_menu_prepare_toolbars();
break;
- case 3: /* Window -> */
+ case 3: /* Make default */
+ gui_window_default_options(current_gui->data.browser.bw);
+ ro_gui_save_options();
+ 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->data.browser.bw->current_content);
+ break;
+ case 1: /* Show hotlist */
+ ro_gui_hotlist_show();
+ break;
+ }
+ break;
+ case 1: /* Window -> */
switch (selection->items[2]) {
case 0:
ro_gui_screen_size(&option_window_screen_width, &option_window_screen_height);
@@ -756,25 +775,6 @@ void ro_gui_menu_selection(wimp_selection *selection)
ro_gui_save_options();
ro_gui_menu_prepare_window();
break;
- case 4: /* Make default */
- gui_window_default_options(current_gui->data.browser.bw);
- ro_gui_save_options();
- 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->data.browser.bw->current_content);
- break;
- case 1: /* Show hotlist */
- ro_gui_hotlist_show();
- break;
- }
- break;
}
break;
case MENU_HELP:
@@ -898,7 +898,7 @@ void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning)
break;
}
break;
- }
+ }
break;
case MENU_OBJECT: /* Object -> */
@@ -983,15 +983,20 @@ void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning)
error = xwimp_create_sub_menu(browser_toolbar_menu,
warning->pos.x, warning->pos.y);
break;
+ }
+ break;
- case 3: /* Window -> */
- ro_gui_menu_prepare_window();
- error = xwimp_create_sub_menu(browser_window_menu,
- warning->pos.x, warning->pos.y);
+ case MENU_UTILITIES:
+ switch (warning->selection.items[1]) {
+ case 0: /* Hotlist -> */
+ break;
+ case 1: /* Window -> */
+ ro_gui_menu_prepare_window();
+ error = xwimp_create_sub_menu(browser_window_menu,
+ warning->pos.x, warning->pos.y);
break;
}
break;
-
case MENU_HELP: /* Help -> */
ro_gui_menu_prepare_help(false);
error = xwimp_create_sub_menu(browser_help_menu,
@@ -1021,13 +1026,13 @@ void ro_gui_menu_hotlist_warning(wimp_message_menu_warning *warning)
hotlist_insert = true;
switch (warning->selection.items[2]) {
case 0: /* Folder */
- ro_gui_hotlist_prepare_folder_dialog(false);
+ ro_gui_hotlist_prepare_folder_dialog(false);
error = xwimp_create_sub_menu(
(wimp_menu *) dialog_folder,
warning->pos.x, warning->pos.y);
- break;
+ break;
case 1: /* Entry */
- ro_gui_hotlist_prepare_entry_dialog(false);
+ ro_gui_hotlist_prepare_entry_dialog(false);
error = xwimp_create_sub_menu(
(wimp_menu *) dialog_entry,
warning->pos.x, warning->pos.y);
@@ -1056,7 +1061,7 @@ void ro_gui_menu_hotlist_warning(wimp_message_menu_warning *warning)
(wimp_menu *) dialog_folder,
warning->pos.x, warning->pos.y);
} else {
- ro_gui_hotlist_prepare_entry_dialog(true);
+ ro_gui_hotlist_prepare_entry_dialog(true);
error = xwimp_create_sub_menu(
(wimp_menu *) dialog_entry,
warning->pos.x, warning->pos.y);
diff --git a/riscos/save.c b/riscos/save.c
index cd6c6be4f..4dd7ab495 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -134,7 +134,7 @@ void ro_gui_save_click(wimp_pointer *pointer)
break;
case ICON_SAVE_CANCEL:
if (pointer->buttons == wimp_CLICK_SELECT) {
- xwimp_close_window(pointer->w);
+ ro_gui_dialog_close(pointer->w);
xwimp_create_menu((wimp_menu *)-1, 0, 0);
} else if (pointer->buttons == wimp_CLICK_ADJUST) {
/* ro_gui_menu_prepare_save(gui_save_content); */
@@ -310,7 +310,7 @@ void ro_gui_save_datasave_ack(wimp_message *message)
/* Close the save window
*/
- xwimp_close_window(dialog_saveas);
+ ro_gui_dialog_close(dialog_saveas);
/* Ack successful save with message_DATA_LOAD */
message->action = message_DATA_LOAD;