/** * Handle Message_MenuWarning. */ void ro_gui_menu_warning(wimp_message_menu_warning *warning) { int i; menu_action action; wimp_menu_entry *menu_entry; os_error *error; assert(current_menu); assert(current_menu_window); /* get the sub-menu of the warning */ if (warning->selection.items[0] == -1) return; menu_entry = ¤t_menu->entries[warning->selection.items[0]]; for (i = 1; warning->selection.items[i] != -1; i++) menu_entry = &menu_entry->sub_menu-> entries[warning->selection.items[i]]; action = ro_gui_menu_find_action(current_menu, menu_entry); /* Process the warning via Wimp_Event, then register the resulting * submenu with the module. */ ro_gui_wimp_event_submenu_warning(current_menu_window, current_menu_icon, current_menu, &(warning->selection), action); if (IS_MENU(menu_entry->sub_menu)) { ro_gui_wimp_event_register_submenu((wimp_w) 0); } else { ro_gui_wimp_event_register_submenu((wimp_w) menu_entry->sub_menu); /* If this is a dialogue box, remove the close and back icons. */ ro_gui_wimp_update_window_furniture((wimp_w) menu_entry->sub_menu, wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_BACK_ICON, 0); } /* open the sub-menu */ error = xwimp_create_sub_menu(menu_entry->sub_menu, warning->pos.x, warning->pos.y); if (error) { LOG(("xwimp_create_sub_menu: 0x%x: %s", error->errnum, error->errmess)); warn_user("MenuError", error->errmess); } }
void ro_gui_save_open(int save_type, int x, int y) { char icon_buf[20]; const char *icon = icon_buf; os_error *error; gui_save_current_type = save_type; if (save_type == SAVE_THEME) { if (theme_filename == NULL) { theme_filename = malloc(6); if (!theme_filename) { LOG(("No memory for malloc()")); warn_user("NoMemory", 0); return; } sprintf(theme_filename, "Theme"); } gui_save_filetype = 0xffd; ro_gui_set_window_title(dialog_saveas, messages_get("SaveTitle")); ro_gui_set_icon_string(dialog_saveas, ICON_SAVE_PATH, theme_filename); reset_filename = theme_filename; } else { if (sprite_filename == NULL) { sprite_filename = malloc(8); if (!sprite_filename) { LOG(("No memory for malloc()")); warn_user("NoMemory", 0); return; } sprintf(sprite_filename, "Sprites"); } gui_save_filetype = 0xff9; ro_gui_set_window_title(dialog_saveas, messages_get("ExportTitle")); ro_gui_set_icon_string(dialog_saveas, ICON_SAVE_PATH, sprite_filename); reset_filename = sprite_filename; } /* icon */ sprintf(icon_buf, "file_%.3x", gui_save_filetype); ro_gui_set_icon_string(dialog_saveas, ICON_SAVE_ICON, icon); /* open sub menu or persistent dialog */ error = xwimp_create_sub_menu((wimp_menu *) dialog_saveas, x, y); if (error) { LOG(("xwimp_create_sub_menu: 0x%x: %s", error->errnum, error->errmess)); warn_user("MenuError", error->errmess); } }