2003-08-22 01:39:07 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
2004-06-27 02:31:34 +04:00
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
2003-08-22 01:39:07 +04:00
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2004-02-25 18:12:58 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
2003-08-22 01:39:07 +04:00
|
|
|
* Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
|
2005-02-07 17:28:43 +03:00
|
|
|
* Copyright 2005 Richard Wilson <info@tinct.net>
|
2003-08-22 01:39:07 +04:00
|
|
|
*/
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/** \file
|
|
|
|
* Menu creation and handling (implementation).
|
|
|
|
*/
|
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2004-09-14 03:56:18 +04:00
|
|
|
#include "oslib/font.h"
|
2004-05-14 23:59:09 +04:00
|
|
|
#include "oslib/os.h"
|
2004-07-28 00:44:46 +04:00
|
|
|
#include "oslib/osgbpb.h"
|
2003-08-22 01:39:07 +04:00
|
|
|
#include "oslib/wimp.h"
|
2004-07-04 18:59:29 +04:00
|
|
|
#include "oslib/wimpspriteop.h"
|
2005-02-07 17:28:43 +03:00
|
|
|
#include "netsurf/content/url_store.h"
|
2003-08-22 01:39:07 +04:00
|
|
|
#include "netsurf/desktop/gui.h"
|
2004-08-11 23:02:32 +04:00
|
|
|
#include "netsurf/render/box.h"
|
2004-07-18 03:32:09 +04:00
|
|
|
#include "netsurf/render/form.h"
|
2003-08-22 01:39:07 +04:00
|
|
|
#include "netsurf/riscos/gui.h"
|
2005-02-07 17:28:43 +03:00
|
|
|
#include "netsurf/riscos/global_history.h"
|
2004-05-14 23:59:09 +04:00
|
|
|
#include "netsurf/riscos/help.h"
|
2004-04-13 23:04:32 +04:00
|
|
|
#include "netsurf/riscos/options.h"
|
2004-11-03 02:23:07 +03:00
|
|
|
#include "netsurf/riscos/tinct.h"
|
2004-07-17 17:00:38 +04:00
|
|
|
#include "netsurf/riscos/theme.h"
|
2004-12-09 13:30:44 +03:00
|
|
|
#include "netsurf/riscos/treeview.h"
|
2004-05-05 20:33:15 +04:00
|
|
|
#include "netsurf/riscos/wimp.h"
|
2003-08-22 01:39:07 +04:00
|
|
|
#include "netsurf/utils/log.h"
|
|
|
|
#include "netsurf/utils/messages.h"
|
2004-03-28 03:18:52 +04:00
|
|
|
#include "netsurf/utils/url.h"
|
2003-08-22 01:39:07 +04:00
|
|
|
#include "netsurf/utils/utils.h"
|
|
|
|
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
/* Menu index definitions used by menu decoding code so that entries can
|
|
|
|
be quickly commented out. Use -ve numbers below -1 to hide an entry.
|
|
|
|
*/
|
|
|
|
#define MENU_PAGE 0
|
2004-05-05 04:02:13 +04:00
|
|
|
#define MENU_OBJECT 1
|
2004-05-05 02:23:44 +04:00
|
|
|
#define MENU_SELECTION -2
|
2004-05-05 04:02:13 +04:00
|
|
|
#define MENU_NAVIGATE 2
|
|
|
|
#define MENU_VIEW 3
|
2004-06-30 03:13:40 +04:00
|
|
|
#define MENU_UTILITIES 4
|
|
|
|
#define MENU_HELP 5
|
2004-05-05 02:23:44 +04:00
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
static void translate_menu(wimp_menu *menu);
|
2004-07-28 00:44:46 +04:00
|
|
|
static void build_languages_menu(void);
|
2004-04-13 23:04:32 +04:00
|
|
|
static void ro_gui_menu_prepare_images(void);
|
2004-06-27 19:34:46 +04:00
|
|
|
static void ro_gui_menu_prepare_window(void);
|
2004-10-05 03:54:42 +04:00
|
|
|
static void ro_gui_menu_prepare_theme(void);
|
2004-05-05 02:23:44 +04:00
|
|
|
static void ro_gui_menu_prepare_toolbars(void);
|
2004-07-21 00:02:59 +04:00
|
|
|
static void ro_gui_menu_prepare_render(void);
|
2004-05-14 23:59:09 +04:00
|
|
|
static void ro_gui_menu_prepare_help(int forced);
|
2004-09-02 00:57:25 +04:00
|
|
|
static void ro_gui_menu_prepare_view(void);
|
2004-05-05 04:02:13 +04:00
|
|
|
static void ro_gui_menu_objectinfo(wimp_message_menu_warning *warning);
|
2004-06-29 21:26:42 +04:00
|
|
|
static void ro_gui_menu_object_reload(void);
|
2004-07-11 17:05:38 +04:00
|
|
|
static void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning);
|
2004-07-06 02:17:59 +04:00
|
|
|
static void ro_gui_menu_hotlist_warning(wimp_message_menu_warning *warning);
|
2005-02-07 17:28:43 +03:00
|
|
|
static void ro_gui_menu_global_history_warning(wimp_message_menu_warning *warning);
|
2004-09-14 03:56:18 +04:00
|
|
|
static void ro_gui_font_menu_selection(wimp_selection *selection);
|
2004-04-13 23:04:32 +04:00
|
|
|
|
2004-07-17 17:00:38 +04:00
|
|
|
struct gui_window *current_gui;
|
2004-05-12 03:40:07 +04:00
|
|
|
wimp_menu *current_menu;
|
2004-02-25 18:12:58 +03:00
|
|
|
static int current_menu_x, current_menu_y;
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
/** Box for object under menu, or 0 if no object. */
|
|
|
|
static struct box *gui_menu_object_box = 0;
|
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
/** Menu of options for form select controls. */
|
|
|
|
static wimp_menu *gui_form_select_menu = 0;
|
|
|
|
/** Form control which gui_form_select_menu is for. */
|
|
|
|
static struct form_control *gui_form_select_control;
|
|
|
|
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
/* Default menu item flags
|
|
|
|
*/
|
2003-08-22 01:39:07 +04:00
|
|
|
#define DEFAULT_FLAGS (wimp_ICON_TEXT | wimp_ICON_FILLED | \
|
|
|
|
(wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) | \
|
|
|
|
(wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT))
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
|
|
|
/* Iconbar menu
|
|
|
|
*/
|
2004-07-01 02:09:20 +04:00
|
|
|
static wimp_MENU(4) ibar_menu = {
|
2003-08-22 01:39:07 +04:00
|
|
|
{ "NetSurf" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Info" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "AppHelp" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Choices" } },
|
2003-08-22 01:39:07 +04:00
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Quit" } }
|
|
|
|
}
|
|
|
|
};
|
2003-09-26 20:52:53 +04:00
|
|
|
int iconbar_menu_height = 4 * 44;
|
2004-07-01 02:09:20 +04:00
|
|
|
wimp_menu *iconbar_menu = (wimp_menu *)&ibar_menu;
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
|
|
|
/* Export submenu
|
|
|
|
*/
|
2004-03-25 02:51:08 +03:00
|
|
|
static wimp_MENU(2) export_menu = {
|
2004-02-26 03:44:42 +03:00
|
|
|
{ "ExportAs" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "Draw" } },
|
2004-05-05 02:23:44 +04:00
|
|
|
{ wimp_MENU_LAST | wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "Text" } }
|
2004-02-26 03:44:42 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-05-05 04:02:13 +04:00
|
|
|
static wimp_MENU(3) link_menu = {
|
|
|
|
{ "SaveLink" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu*)1, DEFAULT_FLAGS, { "URI" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu*)1, DEFAULT_FLAGS, { "URL" } },
|
|
|
|
{ wimp_MENU_LAST | wimp_MENU_GIVE_WARNING, (wimp_menu*)1, DEFAULT_FLAGS, { "LinkText" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
|
|
|
/* Page submenu
|
|
|
|
*/
|
2004-06-27 19:34:46 +04:00
|
|
|
static wimp_MENU(8) page_menu = {
|
2003-08-22 01:39:07 +04:00
|
|
|
{ "Page" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
2004-12-09 13:30:44 +03:00
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "PageInfo" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "Save" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "SaveComp" } },
|
|
|
|
{ 0, (wimp_menu *)&export_menu, DEFAULT_FLAGS, { "Export" } },
|
|
|
|
{ 0, (wimp_menu *)&link_menu, DEFAULT_FLAGS, { "SaveURL" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING | wimp_MENU_SEPARATE, (wimp_menu *)1, DEFAULT_FLAGS, { "Print" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "NewWindow" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ViewSrc" } }
|
2004-05-05 02:23:44 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Object export submenu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(2) object_export_menu = {
|
|
|
|
{ "ExportAs" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
|
|
|
{ wimp_MENU_LAST | wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "Sprite" } }
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
|
|
|
/* Object submenu
|
|
|
|
*/
|
2004-06-29 21:26:42 +04:00
|
|
|
static wimp_MENU(5) object_menu = {
|
2004-05-05 02:23:44 +04:00
|
|
|
{ "Object" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "ObjInfo" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "ObjSave" } },
|
|
|
|
{ 0, (wimp_menu *)&object_export_menu, DEFAULT_FLAGS, { "Export" } },
|
2004-06-29 21:26:42 +04:00
|
|
|
{ wimp_MENU_SEPARATE, (wimp_menu *)&link_menu, DEFAULT_FLAGS, { "SaveURL" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ObjReload" } }
|
2004-05-05 02:23:44 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Selection submenu
|
|
|
|
*/
|
2003-08-22 01:39:07 +04:00
|
|
|
static wimp_MENU(3) selection_menu = {
|
|
|
|
{ "Selection" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-05-05 02:23:44 +04:00
|
|
|
{ wimp_MENU_SEPARATE, wimp_NO_SUB_MENU, DEFAULT_FLAGS | wimp_ICON_SHADED, { "Copy" } },
|
2004-06-27 02:31:34 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS | wimp_ICON_SHADED, { "SelectAll" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS | wimp_ICON_SHADED, { "Clear" } }
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
|
|
|
/* Navigate submenu
|
|
|
|
*/
|
2003-08-22 01:39:07 +04:00
|
|
|
static wimp_MENU(5) navigate_menu = {
|
|
|
|
{ "Navigate" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Home" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Back" } },
|
|
|
|
{ wimp_MENU_SEPARATE, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Forward" } },
|
2004-06-27 19:34:46 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Reload" } },
|
2004-06-27 02:31:34 +04:00
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Stop" } }
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
|
|
|
/* Image submenu
|
|
|
|
*/
|
2004-11-03 02:23:07 +03:00
|
|
|
static wimp_MENU(3) image_menu = {
|
2004-04-13 23:04:32 +04:00
|
|
|
{ "Images" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-12-09 13:30:44 +03:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS | wimp_ICON_SHADED, { "ForeImg" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "BackImg" } },
|
2004-04-13 23:04:32 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
|
|
|
/* Toolbar submenu
|
|
|
|
*/
|
2004-10-05 03:54:42 +04:00
|
|
|
static wimp_MENU(4) show_toolbar_menu = {
|
2004-05-05 02:23:44 +04:00
|
|
|
{ "Toolbars" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ToolButtons" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ToolAddress" } },
|
2004-05-05 02:23:44 +04:00
|
|
|
{ wimp_MENU_SEPARATE, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ToolThrob" } },
|
2004-06-27 02:31:34 +04:00
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ToolStatus" } }
|
2004-05-05 02:23:44 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-07-21 00:02:59 +04:00
|
|
|
/* Render submenu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(3) render_menu = {
|
|
|
|
{ "Render" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
|
|
|
{ wimp_MENU_SEPARATE, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "RenderText" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "RenderAnims" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "RenderAll" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-05-23 16:22:05 +04:00
|
|
|
/* Window submenu
|
|
|
|
*/
|
2004-06-28 23:35:04 +04:00
|
|
|
static wimp_MENU(4) window_menu = {
|
2004-05-23 16:22:05 +04:00
|
|
|
{ "Window" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-06-27 19:34:46 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "WindowSave" } },
|
2004-06-28 23:35:04 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "WindowStagr" } },
|
|
|
|
{ wimp_MENU_SEPARATE, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "WindowSize" } },
|
2004-06-27 19:34:46 +04:00
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "WindowReset" } }
|
2004-05-23 16:22:05 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
/* View submenu
|
|
|
|
*/
|
2004-07-21 00:02:59 +04:00
|
|
|
static wimp_MENU(5) view_menu = {
|
2004-02-25 18:12:58 +03:00
|
|
|
{ "View" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-11-15 00:07:55 +03:00
|
|
|
{ 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 *)&show_toolbar_menu, DEFAULT_FLAGS, { "Toolbars" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING | wimp_MENU_SEPARATE, (wimp_menu *)&render_menu, DEFAULT_FLAGS, { "Render" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "OptDefault" } }
|
2004-02-25 18:12:58 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-04-13 23:04:32 +04:00
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
/* Hotlist submenu
|
|
|
|
*/
|
2004-07-04 22:44:51 +04:00
|
|
|
static wimp_MENU(2) hotlist_util_menu = {
|
2004-05-05 02:23:44 +04:00
|
|
|
{ "Hotlist" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HotlistAdd" } },
|
2004-05-05 02:23:44 +04:00
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HotlistShow" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/* Hotlist submenu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(2) history_util_menu = {
|
|
|
|
{ "History" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HistLocal" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HistGlobal" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
/* Utilities submenu
|
|
|
|
*/
|
2005-02-07 17:28:43 +03:00
|
|
|
static wimp_MENU(4) utilities_menu = {
|
2004-05-05 02:23:44 +04:00
|
|
|
{ "Utilities" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2005-02-07 17:28:43 +03:00
|
|
|
{ 0, (wimp_menu *)&hotlist_util_menu, DEFAULT_FLAGS, { "Hotlist" } },
|
|
|
|
{ 0, (wimp_menu *)&history_util_menu, DEFAULT_FLAGS, { "History" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "FindText" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING | wimp_MENU_LAST, (wimp_menu *)&window_menu, DEFAULT_FLAGS, { "Window" } },
|
|
|
|
}
|
2004-05-05 02:23:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Help submenu
|
|
|
|
*/
|
2004-06-11 16:19:57 +04:00
|
|
|
static wimp_MENU(5) help_menu = {
|
2004-04-13 23:04:32 +04:00
|
|
|
{ "Help" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HelpContent" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HelpGuide" } },
|
2004-05-14 23:59:09 +04:00
|
|
|
{ wimp_MENU_SEPARATE, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HelpInfo" } },
|
2004-06-11 16:19:57 +04:00
|
|
|
{ wimp_MENU_SEPARATE, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HelpAbout" } },
|
2004-06-27 02:31:34 +04:00
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "HelpInter" } }
|
2004-04-13 23:04:32 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
/* Main browser menu
|
|
|
|
*/
|
2004-06-30 03:13:40 +04:00
|
|
|
static wimp_MENU(6) menu = {
|
2003-08-22 01:39:07 +04:00
|
|
|
{ "NetSurf" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
{ 0, (wimp_menu *)&page_menu, DEFAULT_FLAGS, { "Page" } },
|
|
|
|
{ 0, (wimp_menu *)&object_menu, DEFAULT_FLAGS, { "Object" } },
|
|
|
|
// { 0, (wimp_menu *)&selection_menu, DEFAULT_FLAGS, { "Selection" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)&navigate_menu, DEFAULT_FLAGS, { "Navigate" } },
|
2004-09-02 00:57:25 +04:00
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)&view_menu, DEFAULT_FLAGS, { "View" } },
|
2004-06-30 03:13:40 +04:00
|
|
|
{ 0, (wimp_menu *)&utilities_menu, DEFAULT_FLAGS, { "Utilities" } },
|
2004-06-27 02:31:34 +04:00
|
|
|
{ wimp_MENU_LAST | wimp_MENU_GIVE_WARNING, (wimp_menu *)&help_menu, DEFAULT_FLAGS, { "Help" } }
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
};
|
2004-05-02 03:40:37 +04:00
|
|
|
wimp_menu *browser_menu = (wimp_menu *) &menu;
|
2003-08-22 01:39:07 +04:00
|
|
|
|
|
|
|
|
2004-07-04 22:44:51 +04:00
|
|
|
|
2004-07-06 02:17:59 +04:00
|
|
|
/* Hotlist new submenu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(2) hotlist_new = {
|
|
|
|
{ "New" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-07-09 02:05:35 +04:00
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "Folder" } },
|
|
|
|
{ wimp_MENU_LAST | wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "Link" } },
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Hotlist expand submenu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(3) hotlist_expand = {
|
|
|
|
{ "Expand" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "All" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Folders" } },
|
2004-10-05 03:54:42 +04:00
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Links" } }
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Hotlist collapse submenu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(3) hotlist_collapse = {
|
|
|
|
{ "Collapse" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "All" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Folders" } },
|
2004-10-05 03:54:42 +04:00
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Links" } }
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-07-04 22:44:51 +04:00
|
|
|
/* Hotlist file submenu
|
|
|
|
*/
|
2004-12-09 13:30:44 +03:00
|
|
|
static wimp_MENU(4) hotlist_file = {
|
2004-07-04 22:44:51 +04:00
|
|
|
{ "Hotlist" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-07-09 02:05:35 +04:00
|
|
|
{ 0, (wimp_menu *)&hotlist_new, DEFAULT_FLAGS, { "New" } },
|
2004-07-06 02:17:59 +04:00
|
|
|
{ wimp_MENU_GIVE_WARNING | wimp_MENU_SEPARATE, (wimp_menu *)1, DEFAULT_FLAGS, { "Export" } },
|
|
|
|
{ 0, (wimp_menu *)&hotlist_expand, DEFAULT_FLAGS, { "Expand" } },
|
2004-10-05 03:54:42 +04:00
|
|
|
{ wimp_MENU_LAST, (wimp_menu *)&hotlist_collapse, DEFAULT_FLAGS, { "Collapse" } }
|
2004-07-04 22:44:51 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/* History file submenu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(4) history_file = {
|
|
|
|
{ "History" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
|
|
|
{ wimp_MENU_GIVE_WARNING | wimp_MENU_SEPARATE, (wimp_menu *)1, DEFAULT_FLAGS, { "Export" } },
|
|
|
|
{ 0, (wimp_menu *)&hotlist_expand, DEFAULT_FLAGS, { "Expand" } },
|
|
|
|
{ wimp_MENU_LAST, (wimp_menu *)&hotlist_collapse, DEFAULT_FLAGS, { "Collapse" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-07-04 22:44:51 +04:00
|
|
|
/* Hotlist file submenu
|
|
|
|
*/
|
2004-12-09 13:30:44 +03:00
|
|
|
static wimp_MENU(4) hotlist_select = {
|
2004-07-04 22:44:51 +04:00
|
|
|
{ "Selection" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
2004-12-09 13:30:44 +03:00
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)1, DEFAULT_FLAGS, { "Edit" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Launch" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Delete" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ResetUsage" } }
|
2004-07-04 22:44:51 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/* History file submenu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(4) history_select = {
|
|
|
|
{ "Selection" }, 7,2,7,0, 300, 44, 0,
|
|
|
|
{
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Launch" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Delete" } },
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-07-04 22:44:51 +04:00
|
|
|
/* Hotlist menu
|
|
|
|
*/
|
2004-07-06 02:17:59 +04:00
|
|
|
static wimp_MENU(4) hotlist_root = {
|
2004-07-04 22:44:51 +04:00
|
|
|
{ "Hotlist" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
2004-07-06 02:17:59 +04:00
|
|
|
{ 0, (wimp_menu *)&hotlist_file, DEFAULT_FLAGS, { "Hotlist" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)&hotlist_select, DEFAULT_FLAGS, { "Selection" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "SelectAll" } },
|
2004-10-05 03:54:42 +04:00
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Clear" } }
|
2004-07-04 22:44:51 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
wimp_menu *hotlist_menu = (wimp_menu *)&hotlist_root;
|
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/* History menu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(4) history_root = {
|
|
|
|
{ "History" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
|
|
|
{ 0, (wimp_menu *)&history_file, DEFAULT_FLAGS, { "History" } },
|
|
|
|
{ wimp_MENU_GIVE_WARNING, (wimp_menu *)&history_select, DEFAULT_FLAGS, { "Selection" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "SelectAll" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "Clear" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
wimp_menu *global_history_menu = (wimp_menu *)&history_root;
|
|
|
|
|
2004-07-04 22:44:51 +04:00
|
|
|
|
2004-07-28 00:44:46 +04:00
|
|
|
/* Proxy auth popup menu (used in proxy Choices dialog)
|
2004-07-27 19:49:28 +04:00
|
|
|
*/
|
|
|
|
static wimp_MENU(3) proxy_menu = {
|
|
|
|
{ "ProxyAuth" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
2004-10-05 03:54:42 +04:00
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ProxyNone" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ProxyBasic" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ProxyNTLM" } }
|
2004-07-27 19:49:28 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
wimp_menu *proxyauth_menu = (wimp_menu *) &proxy_menu;
|
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
|
2004-11-03 02:23:07 +03:00
|
|
|
/* Image display quality popup menu (used in image Choices dialog)
|
|
|
|
*/
|
|
|
|
static wimp_MENU(4) imageq_menu = {
|
|
|
|
{ "Display" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ImgStyle0" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ImgStyle1" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ImgStyle2" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ImgStyle3" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
wimp_menu *image_quality_menu = (wimp_menu *) &imageq_menu;
|
|
|
|
|
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
/* Toolbar icon submenus.
|
|
|
|
The index of the name must be identical to the toolbar icon number.
|
|
|
|
*/
|
|
|
|
static wimp_MENU(11) toolbar_browser = {
|
|
|
|
{ "Icons" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconBack" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconForward" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconStop" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconReload" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconHome" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconHistory" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconSave" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconPrint" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconHotlist" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconScale" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconSearch" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
wimp_menu *toolbar_browser_menu = (wimp_menu *)&toolbar_browser;
|
|
|
|
|
|
|
|
static wimp_MENU(5) toolbar_hotlist = {
|
|
|
|
{ "Icons" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconCreate" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconDelete" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconExpand" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconOpen" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "IconLaunch" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
wimp_menu *toolbar_hotlist_menu = (wimp_menu *)&toolbar_hotlist;
|
|
|
|
|
|
|
|
/* Toolbar icon menu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(5) toolbar = {
|
|
|
|
{ "Toolbar" }, 7,2,7,0, 200, 44, 0,
|
|
|
|
{
|
|
|
|
{ 0, (wimp_menu *)&toolbar_browser, DEFAULT_FLAGS, { "Icons" } },
|
|
|
|
{ 0, (wimp_menu *)&show_toolbar_menu, DEFAULT_FLAGS, { "Toolbars" } },
|
|
|
|
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "AddGap" } },
|
|
|
|
{ wimp_MENU_SEPARATE, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "DeleteGap" } },
|
|
|
|
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "LockToolbar" } }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
wimp_menu *toolbar_menu = (wimp_menu *)&toolbar;
|
|
|
|
|
|
|
|
|
|
|
|
/* Current toolbar
|
2005-01-02 01:05:21 +03:00
|
|
|
*/
|
2004-10-05 03:54:42 +04:00
|
|
|
struct toolbar *current_toolbar;
|
|
|
|
static struct toolbar_icon *current_toolbar_icon;
|
|
|
|
|
2004-07-28 00:44:46 +04:00
|
|
|
/* Languages popup menu (used in browser choices dialog)
|
|
|
|
*/
|
|
|
|
wimp_menu *languages_menu = NULL;
|
2004-07-04 22:44:51 +04:00
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
/* Toolbar menu
|
|
|
|
*/
|
|
|
|
wimp_menu *toolbar_icon_menu = NULL;
|
|
|
|
|
2004-09-14 03:56:18 +04:00
|
|
|
/* Font popup menu (used in font choices dialog)
|
|
|
|
*/
|
|
|
|
static wimp_menu *font_menu = NULL;
|
|
|
|
static byte *font_menu_data = NULL;
|
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/* URL suggestion menu
|
|
|
|
*/
|
|
|
|
static wimp_MENU(GLOBAL_HISTORY_RECENT_URLS) url_suggest;
|
|
|
|
wimp_menu *url_suggest_menu = (wimp_menu *)&url_suggest;
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
static wimp_menu *browser_page_menu = (wimp_menu *)&page_menu;
|
|
|
|
static wimp_menu *browser_export_menu = (wimp_menu *)&export_menu;
|
|
|
|
static wimp_menu *browser_object_menu = (wimp_menu *)&object_menu;
|
2004-05-05 04:02:13 +04:00
|
|
|
static wimp_menu *browser_link_menu = (wimp_menu *)&link_menu;
|
2004-05-05 02:23:44 +04:00
|
|
|
static wimp_menu *browser_object_export_menu = (wimp_menu *)&object_export_menu;
|
|
|
|
static wimp_menu *browser_selection_menu = (wimp_menu *)&selection_menu;
|
|
|
|
static wimp_menu *browser_navigate_menu = (wimp_menu *)&navigate_menu;
|
|
|
|
static wimp_menu *browser_view_menu = (wimp_menu *)&view_menu;
|
|
|
|
static wimp_menu *browser_image_menu = (wimp_menu *)&image_menu;
|
2004-10-05 03:54:42 +04:00
|
|
|
static wimp_menu *browser_toolbar_menu = (wimp_menu *)&show_toolbar_menu;
|
2004-07-21 00:02:59 +04:00
|
|
|
static wimp_menu *browser_render_menu = (wimp_menu *)&render_menu;
|
2004-05-23 16:22:05 +04:00
|
|
|
static wimp_menu *browser_window_menu = (wimp_menu *)&window_menu;
|
2004-05-05 02:23:44 +04:00
|
|
|
static wimp_menu *browser_utilities_menu = (wimp_menu *)&utilities_menu;
|
2004-07-04 22:44:51 +04:00
|
|
|
static wimp_menu *browser_hotlist_menu = (wimp_menu *)&hotlist_util_menu;
|
2005-02-07 17:28:43 +03:00
|
|
|
static wimp_menu *browser_history_menu = (wimp_menu *)&history_util_menu;
|
2004-05-05 02:23:44 +04:00
|
|
|
static wimp_menu *browser_help_menu = (wimp_menu *)&help_menu;
|
2004-07-06 02:17:59 +04:00
|
|
|
|
|
|
|
static wimp_menu *hotlist_new_menu = (wimp_menu *)&hotlist_new;
|
|
|
|
static wimp_menu *hotlist_expand_menu = (wimp_menu *)&hotlist_expand;
|
|
|
|
static wimp_menu *hotlist_collapse_menu = (wimp_menu *)&hotlist_collapse;
|
2004-07-04 22:44:51 +04:00
|
|
|
static wimp_menu *hotlist_file_menu = (wimp_menu *)&hotlist_file;
|
|
|
|
static wimp_menu *hotlist_select_menu = (wimp_menu *)&hotlist_select;
|
2004-05-05 02:23:44 +04:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
static wimp_menu *history_file_menu = (wimp_menu *)&history_file;
|
|
|
|
static wimp_menu *history_select_menu = (wimp_menu *)&history_select;
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
/**
|
|
|
|
* Create menu structures.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_menus_init(void)
|
|
|
|
{
|
|
|
|
translate_menu(iconbar_menu);
|
2004-07-06 02:17:59 +04:00
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
translate_menu(browser_menu);
|
|
|
|
translate_menu(browser_page_menu);
|
2004-02-26 03:44:42 +03:00
|
|
|
translate_menu(browser_export_menu);
|
2004-05-05 02:23:44 +04:00
|
|
|
translate_menu(browser_object_menu);
|
2004-05-05 04:02:13 +04:00
|
|
|
translate_menu(browser_link_menu);
|
2004-05-05 02:23:44 +04:00
|
|
|
translate_menu(browser_object_export_menu);
|
2003-08-22 01:39:07 +04:00
|
|
|
translate_menu(browser_selection_menu);
|
|
|
|
translate_menu(browser_navigate_menu);
|
2004-02-25 18:12:58 +03:00
|
|
|
translate_menu(browser_view_menu);
|
2004-04-13 23:04:32 +04:00
|
|
|
translate_menu(browser_image_menu);
|
2004-05-05 02:23:44 +04:00
|
|
|
translate_menu(browser_toolbar_menu);
|
2004-07-21 00:02:59 +04:00
|
|
|
translate_menu(browser_render_menu);
|
2004-05-23 16:22:05 +04:00
|
|
|
translate_menu(browser_window_menu);
|
2004-05-05 02:23:44 +04:00
|
|
|
translate_menu(browser_utilities_menu);
|
|
|
|
translate_menu(browser_hotlist_menu);
|
2005-02-07 17:28:43 +03:00
|
|
|
translate_menu(browser_history_menu);
|
2004-04-13 23:04:32 +04:00
|
|
|
translate_menu(browser_help_menu);
|
2004-07-06 02:17:59 +04:00
|
|
|
|
|
|
|
translate_menu(hotlist_menu);
|
|
|
|
translate_menu(hotlist_new_menu);
|
|
|
|
translate_menu(hotlist_expand_menu);
|
|
|
|
translate_menu(hotlist_collapse_menu);
|
2004-07-04 22:44:51 +04:00
|
|
|
translate_menu(hotlist_file_menu);
|
|
|
|
translate_menu(hotlist_select_menu);
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
translate_menu(global_history_menu);
|
|
|
|
translate_menu(history_file_menu);
|
|
|
|
translate_menu(history_select_menu);
|
|
|
|
|
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
translate_menu(toolbar_menu);
|
|
|
|
translate_menu(toolbar_browser_menu);
|
|
|
|
translate_menu(toolbar_hotlist_menu);
|
2005-01-02 01:05:21 +03:00
|
|
|
|
2004-07-27 19:49:28 +04:00
|
|
|
translate_menu(proxyauth_menu);
|
|
|
|
|
2004-11-03 02:23:07 +03:00
|
|
|
translate_menu(image_quality_menu);
|
|
|
|
|
2004-07-28 00:44:46 +04:00
|
|
|
build_languages_menu();
|
|
|
|
|
2003-08-27 02:37:32 +04:00
|
|
|
iconbar_menu->entries[0].sub_menu = (wimp_menu *) dialog_info;
|
2004-04-03 06:59:35 +04:00
|
|
|
browser_page_menu->entries[0].sub_menu = (wimp_menu*) dialog_pageinfo;
|
2004-05-05 04:02:13 +04:00
|
|
|
browser_object_menu->entries[0].sub_menu = (wimp_menu*) dialog_objinfo;
|
2004-05-05 02:23:44 +04:00
|
|
|
// browser_page_menu->entries[1].sub_menu = (wimp_menu *) dialog_saveas;
|
|
|
|
// browser_page_menu->entries[2].sub_menu = (wimp_menu *) dialog_saveas;
|
|
|
|
// browser_export_menu->entries[0].sub_menu = (wimp_menu *) dialog_saveas;
|
|
|
|
// browser_export_menu->entries[1].sub_menu = (wimp_menu *) dialog_saveas;
|
|
|
|
// browser_view_menu->entries[0].sub_menu = (wimp_menu *) dialog_zoom;
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Replace text in a menu with message values.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void translate_menu(wimp_menu *menu)
|
|
|
|
{
|
|
|
|
unsigned int i = 0;
|
2004-07-21 00:02:59 +04:00
|
|
|
const char *indirected_text;
|
2004-04-13 23:04:32 +04:00
|
|
|
|
|
|
|
/* We can't just blindly set something as indirected as if we use
|
|
|
|
the fallback messages text (ie the pointer we gave), we overwrite
|
|
|
|
this data when setting the pointer to the indirected text we
|
|
|
|
already had.
|
|
|
|
*/
|
2004-07-21 00:02:59 +04:00
|
|
|
indirected_text = messages_get(menu->title_data.text);
|
2004-04-13 23:04:32 +04:00
|
|
|
if (indirected_text != menu->title_data.text) {
|
|
|
|
menu->title_data.indirected_text.text = indirected_text;
|
|
|
|
menu->entries[0].menu_flags |= wimp_MENU_TITLE_INDIRECTED;
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
2004-04-25 03:42:32 +04:00
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
/* items */
|
|
|
|
do {
|
2004-07-21 00:02:59 +04:00
|
|
|
indirected_text = messages_get(menu->entries[i].data.text);
|
2004-06-27 02:31:34 +04:00
|
|
|
if (indirected_text != menu->entries[i].data.text) {
|
2004-04-13 23:04:32 +04:00
|
|
|
menu->entries[i].icon_flags |= wimp_ICON_INDIRECTED;
|
|
|
|
menu->entries[i].data.indirected_text.text = indirected_text;
|
|
|
|
menu->entries[i].data.indirected_text.validation = 0;
|
|
|
|
menu->entries[i].data.indirected_text.size = strlen(indirected_text) + 1;
|
|
|
|
}
|
2003-08-22 01:39:07 +04:00
|
|
|
i++;
|
2004-02-25 18:12:58 +03:00
|
|
|
} while ((menu->entries[i - 1].menu_flags & wimp_MENU_LAST) == 0);
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
|
2004-07-28 00:44:46 +04:00
|
|
|
/**
|
|
|
|
* Builds the languages menu based on available translations
|
|
|
|
*/
|
|
|
|
void build_languages_menu(void)
|
|
|
|
{
|
|
|
|
int context = 0, read_count, entries = 0;
|
|
|
|
os_error *e;
|
|
|
|
osgbpb_INFO(100) info;
|
|
|
|
char lang[8] = {0};
|
|
|
|
char *lang_name;
|
|
|
|
void *temp;
|
|
|
|
|
|
|
|
languages_menu = calloc(1, wimp_SIZEOF_MENU(1));
|
|
|
|
if (!languages_menu) {
|
|
|
|
LOG(("No memory for languages menu"));
|
|
|
|
die("Insufficient memory for languages menu");
|
|
|
|
}
|
|
|
|
languages_menu->title_data.indirected_text.text = messages_get("Languages");
|
|
|
|
languages_menu->title_fg = wimp_COLOUR_BLACK;
|
|
|
|
languages_menu->title_bg = wimp_COLOUR_LIGHT_GREY;
|
|
|
|
languages_menu->work_fg = wimp_COLOUR_BLACK;
|
|
|
|
languages_menu->work_bg = wimp_COLOUR_WHITE;
|
|
|
|
languages_menu->width = 300;
|
|
|
|
languages_menu->height = 44;
|
|
|
|
languages_menu->gap = 0;
|
|
|
|
|
|
|
|
while (context != -1) {
|
2004-12-09 13:30:44 +03:00
|
|
|
e = xosgbpb_dir_entries_info("<NetSurf$Dir>.Resources", (osgbpb_info_list*)&info, 1,
|
|
|
|
context, sizeof(info), 0, &read_count, &context);
|
2004-07-28 00:44:46 +04:00
|
|
|
if (e)
|
|
|
|
die(e->errmess);
|
|
|
|
|
|
|
|
if (read_count == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (info.obj_type != fileswitch_IS_DIR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
snprintf(lang, sizeof lang, "lang_%2s", info.name);
|
|
|
|
if ((lang_name = messages_get(lang)) == NULL ||
|
|
|
|
strlen(info.name) != 2)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
temp = realloc(languages_menu, wimp_SIZEOF_MENU(entries+1));
|
|
|
|
if (!temp)
|
|
|
|
die("Insufficient memory for languages menu");
|
|
|
|
|
|
|
|
languages_menu = temp;
|
|
|
|
languages_menu->entries[entries].menu_flags = 0;
|
|
|
|
languages_menu->entries[entries].sub_menu = wimp_NO_SUB_MENU;
|
2004-10-05 03:54:42 +04:00
|
|
|
languages_menu->entries[entries].icon_flags = DEFAULT_FLAGS | wimp_ICON_INDIRECTED;
|
2004-07-28 00:44:46 +04:00
|
|
|
languages_menu->entries[entries].data.indirected_text.text = lang_name;
|
|
|
|
languages_menu->entries[entries].data.indirected_text.validation = (char *)-1;
|
|
|
|
languages_menu->entries[entries].data.indirected_text.size = strlen(lang_name) + 1;
|
|
|
|
|
|
|
|
entries++;
|
|
|
|
}
|
|
|
|
|
|
|
|
languages_menu->entries[0].menu_flags |= wimp_MENU_TITLE_INDIRECTED;
|
|
|
|
languages_menu->entries[entries-1].menu_flags |= wimp_MENU_LAST;
|
|
|
|
}
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
/**
|
2005-02-07 17:28:43 +03:00
|
|
|
* Builds the URL suggestion menu
|
2003-08-22 01:39:07 +04:00
|
|
|
*/
|
2005-02-07 17:28:43 +03:00
|
|
|
bool ro_gui_menu_prepare_url_suggest(void) {
|
|
|
|
char **suggest_text;
|
|
|
|
int suggestions;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
suggest_text = global_history_get_recent(&suggestions);
|
|
|
|
if (suggestions < 1)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
url_suggest_menu->title_data.indirected_text.text = messages_get("URLSuggest");
|
|
|
|
url_suggest_menu->title_fg = wimp_COLOUR_BLACK;
|
|
|
|
url_suggest_menu->title_bg = wimp_COLOUR_LIGHT_GREY;
|
|
|
|
url_suggest_menu->work_fg = wimp_COLOUR_BLACK;
|
|
|
|
url_suggest_menu->work_bg = wimp_COLOUR_WHITE;
|
|
|
|
url_suggest_menu->width = 300;
|
|
|
|
url_suggest_menu->height = 44;
|
|
|
|
url_suggest_menu->gap = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < suggestions; i++) {
|
|
|
|
url_suggest_menu->entries[i].menu_flags = 0;
|
|
|
|
url_suggest_menu->entries[i].sub_menu = wimp_NO_SUB_MENU;
|
|
|
|
url_suggest_menu->entries[i].icon_flags = DEFAULT_FLAGS | wimp_ICON_INDIRECTED;
|
|
|
|
url_suggest_menu->entries[i].data.indirected_text.text = suggest_text[i];
|
|
|
|
url_suggest_menu->entries[i].data.indirected_text.validation = (char *)-1;
|
|
|
|
url_suggest_menu->entries[i].data.indirected_text.size = strlen(suggest_text[i]) + 1;
|
|
|
|
}
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
url_suggest_menu->entries[0].menu_flags |= wimp_MENU_TITLE_INDIRECTED;
|
|
|
|
url_suggest_menu->entries[suggestions - 1].menu_flags |= wimp_MENU_LAST;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display a menu.
|
|
|
|
*/
|
2004-07-17 17:00:38 +04:00
|
|
|
void ro_gui_create_menu(wimp_menu *menu, int x, int y, struct gui_window *g)
|
2003-08-22 01:39:07 +04:00
|
|
|
{
|
2004-07-18 21:38:01 +04:00
|
|
|
int doc_x, doc_y;
|
|
|
|
wimp_window_state state;
|
|
|
|
os_error *error;
|
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
current_gui = g;
|
2004-07-18 21:38:01 +04:00
|
|
|
|
2004-05-07 00:37:48 +04:00
|
|
|
if (menu == browser_menu) {
|
2004-07-18 21:38:01 +04:00
|
|
|
assert(g);
|
|
|
|
|
|
|
|
state.w = g->window;
|
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_window_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_x = window_x_units(x, &state) / 2 / g->option.scale;
|
|
|
|
doc_y = -window_y_units(y, &state) / 2 / g->option.scale;
|
|
|
|
|
|
|
|
gui_menu_object_box = 0;
|
|
|
|
if (g->bw->current_content &&
|
|
|
|
g->bw->current_content->type == CONTENT_HTML) {
|
|
|
|
gui_menu_object_box = box_object_at_point(
|
|
|
|
g->bw->current_content, doc_x, doc_y);
|
|
|
|
}
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
if (!hotlist_tree)
|
2004-07-18 21:38:01 +04:00
|
|
|
browser_utilities_menu->entries[0].icon_flags |=
|
|
|
|
wimp_ICON_SHADED;
|
|
|
|
if (gui_menu_object_box)
|
2004-05-07 00:37:48 +04:00
|
|
|
menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
else
|
|
|
|
menu->entries[1].icon_flags |= wimp_ICON_SHADED;
|
2004-09-02 00:57:25 +04:00
|
|
|
if ((current_gui->bw) && (current_gui->bw->current_content)) {
|
2004-10-05 03:54:42 +04:00
|
|
|
menu->entries[0].icon_flags &= ~wimp_ICON_SHADED;
|
2004-09-02 00:57:25 +04:00
|
|
|
} else {
|
2004-10-05 03:54:42 +04:00
|
|
|
menu->entries[0].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (menu == toolbar_menu) {
|
|
|
|
state.w = current_toolbar->toolbar_handle;
|
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_window_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
2004-09-02 00:57:25 +04:00
|
|
|
}
|
2004-07-18 21:38:01 +04:00
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
current_toolbar_icon = ro_gui_theme_toolbar_get_icon(current_toolbar,
|
|
|
|
x - state.visible.x0, y - state.visible.y0);
|
|
|
|
LOG(("Toolbar (%i,%i)", x - state.visible.x0, y - state.visible.y0));
|
|
|
|
ro_gui_menu_prepare_theme();
|
2004-07-18 21:38:01 +04:00
|
|
|
} else if (menu == hotlist_menu) {
|
2004-07-12 23:55:49 +04:00
|
|
|
ro_gui_menu_prepare_hotlist();
|
2005-02-07 17:28:43 +03:00
|
|
|
} else if (menu == global_history_menu) {
|
|
|
|
ro_gui_menu_prepare_global_history();
|
|
|
|
} else if (menu == url_suggest_menu) {
|
|
|
|
if (!ro_gui_menu_prepare_url_suggest())
|
|
|
|
return;
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
2004-07-18 21:38:01 +04:00
|
|
|
|
|
|
|
error = xwimp_create_menu(menu, x - 64, y);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
2004-12-09 13:30:44 +03:00
|
|
|
} else {
|
|
|
|
current_menu = menu;
|
|
|
|
current_menu_x = x;
|
|
|
|
current_menu_y = y;
|
2004-07-18 21:38:01 +04:00
|
|
|
}
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-19 03:40:28 +03:00
|
|
|
/**
|
|
|
|
* Display a pop-up menu next to the specified icon.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i)
|
|
|
|
{
|
2003-12-27 03:11:57 +03:00
|
|
|
wimp_window_state state;
|
|
|
|
wimp_icon_state icon_state;
|
|
|
|
state.w = w;
|
|
|
|
icon_state.w = w;
|
|
|
|
icon_state.i = i;
|
2003-12-19 03:40:28 +03:00
|
|
|
wimp_get_window_state(&state);
|
|
|
|
wimp_get_icon_state(&icon_state);
|
2004-07-18 21:38:01 +04:00
|
|
|
ro_gui_create_menu(menu,
|
|
|
|
state.visible.x0 + icon_state.icon.extent.x1 + 64,
|
2005-02-07 17:28:43 +03:00
|
|
|
state.visible.y1 + icon_state.icon.extent.y1 - state.yscroll, current_gui);
|
2003-12-19 03:40:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
/**
|
|
|
|
* Handle menu selection.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_menu_selection(wimp_selection *selection)
|
|
|
|
{
|
2004-10-05 03:54:42 +04:00
|
|
|
struct toolbar_icon *icon;
|
|
|
|
struct toolbar_icon *next;
|
2004-12-09 13:30:44 +03:00
|
|
|
struct node *node;
|
2004-10-05 03:54:42 +04:00
|
|
|
char url[80];
|
2003-08-22 01:39:07 +04:00
|
|
|
wimp_pointer pointer;
|
2004-06-27 19:34:46 +04:00
|
|
|
wimp_window_state state;
|
|
|
|
os_error *error;
|
2004-08-31 01:03:48 +04:00
|
|
|
int height;
|
2003-08-22 01:39:07 +04:00
|
|
|
|
|
|
|
wimp_get_pointer_info(&pointer);
|
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
if (current_menu == gui_form_select_menu && 0 <= selection->items[0]) {
|
|
|
|
browser_window_form_select(current_gui->bw,
|
|
|
|
gui_form_select_control,
|
|
|
|
selection->items[0]);
|
2003-08-22 01:39:07 +04:00
|
|
|
|
|
|
|
} else if (current_menu == iconbar_menu) {
|
|
|
|
switch (selection->items[0]) {
|
|
|
|
case 0: /* Info */
|
2003-08-27 02:37:32 +04:00
|
|
|
ro_gui_create_menu((wimp_menu *) dialog_info,
|
2003-08-22 01:39:07 +04:00
|
|
|
pointer.pos.x, pointer.pos.y, 0);
|
|
|
|
break;
|
2004-04-13 23:04:32 +04:00
|
|
|
case 1: /* Help */
|
2004-06-27 02:31:34 +04:00
|
|
|
ro_gui_open_help_page("docs");
|
|
|
|
break;
|
2004-04-13 23:04:32 +04:00
|
|
|
case 2: /* Choices */
|
2004-07-27 19:49:28 +04:00
|
|
|
ro_gui_dialog_open_config();
|
2004-04-13 23:04:32 +04:00
|
|
|
break;
|
2003-09-26 20:52:53 +04:00
|
|
|
case 3: /* Quit */
|
2003-11-06 22:41:41 +03:00
|
|
|
netsurf_quit = true;
|
2003-08-22 01:39:07 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
} else if (current_menu == url_suggest_menu) {
|
|
|
|
if (!current_gui)
|
|
|
|
LOG(("No current GUI"));
|
|
|
|
else if (selection->items[0] >= 0) {
|
|
|
|
browser_window_go(current_gui->bw,
|
|
|
|
url_suggest_menu->entries[selection->items[0]].data.indirected_text.text, 0);
|
|
|
|
global_history_add_recent(url_suggest_menu->entries[selection->items[0]].data.indirected_text.text);
|
|
|
|
}
|
2004-10-05 03:54:42 +04:00
|
|
|
} else if (current_menu == toolbar_menu) {
|
|
|
|
switch (selection->items[0]) {
|
|
|
|
case 0: /* Icons-> */
|
|
|
|
if (selection->items[1] == -1) break;
|
|
|
|
next = current_toolbar->icon;
|
|
|
|
while ((icon = next) != NULL) {
|
|
|
|
next = icon->next;
|
|
|
|
if (icon->icon_number == selection->items[1]) {
|
|
|
|
icon->display = !icon->display;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
current_toolbar->reformat_buttons = true;
|
|
|
|
height = current_toolbar->height;
|
|
|
|
ro_gui_theme_process_toolbar(current_toolbar, -1);
|
|
|
|
if ((height != current_toolbar->height) && (current_gui))
|
|
|
|
ro_gui_window_update_dimensions(current_gui,
|
|
|
|
height - current_toolbar->height);
|
2004-12-09 13:30:44 +03:00
|
|
|
/* if ((height != current_toolbar->height) &&
|
2004-10-05 03:54:42 +04:00
|
|
|
(current_toolbar == hotlist_toolbar)) {
|
2005-01-02 01:05:21 +03:00
|
|
|
xwimp_force_redraw(hotlist_window, 0, -16384, 16384, 16384);
|
2004-10-05 03:54:42 +04:00
|
|
|
}
|
2004-12-09 13:30:44 +03:00
|
|
|
*/ ro_gui_menu_prepare_theme();
|
2005-01-02 01:05:21 +03:00
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
break;
|
|
|
|
case 1: /* Toolbars-> */
|
|
|
|
switch (selection->items[1]) {
|
|
|
|
case 0:
|
|
|
|
current_toolbar->display_buttons =
|
|
|
|
!current_toolbar->display_buttons;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
current_toolbar->display_url =
|
|
|
|
!current_toolbar->display_url;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
current_toolbar->display_throbber =
|
|
|
|
!current_toolbar->display_throbber;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
current_toolbar->display_status =
|
|
|
|
!current_toolbar->display_status;
|
|
|
|
break;
|
|
|
|
}
|
2004-11-15 00:07:55 +03:00
|
|
|
ro_gui_menu_prepare_theme();
|
2004-10-05 03:54:42 +04:00
|
|
|
current_toolbar->reformat_buttons = true;
|
|
|
|
height = current_toolbar->height;
|
|
|
|
ro_gui_theme_process_toolbar(current_toolbar, -1);
|
|
|
|
if ((height != current_toolbar->height) && (current_gui))
|
|
|
|
ro_gui_window_update_dimensions(current_gui,
|
|
|
|
height - current_toolbar->height);
|
|
|
|
break;
|
|
|
|
case 2: /* Add separator */
|
|
|
|
break;
|
|
|
|
case 3: /* Remove separator */
|
|
|
|
break;
|
|
|
|
case 4: /* Lock toolbar */
|
|
|
|
current_toolbar->locked = !current_toolbar->locked;
|
|
|
|
ro_gui_menu_prepare_theme();
|
|
|
|
break;
|
|
|
|
}
|
2004-07-06 02:17:59 +04:00
|
|
|
} else if (current_menu == hotlist_menu) {
|
|
|
|
switch (selection->items[0]) {
|
|
|
|
case 0: /* Hotlist-> */
|
|
|
|
switch (selection->items[1]) {
|
|
|
|
case 0: /* New */
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-12-09 13:30:44 +03:00
|
|
|
case 1: /* Export */
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-12-09 13:30:44 +03:00
|
|
|
case 2: /* Expand */
|
|
|
|
tree_handle_expansion(hotlist_tree, hotlist_tree->root, true,
|
|
|
|
(selection->items[2] != 2), (selection->items[2] != 1));
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-12-09 13:30:44 +03:00
|
|
|
case 3: /* Collapse */
|
|
|
|
tree_handle_expansion(hotlist_tree, hotlist_tree->root, false,
|
|
|
|
(selection->items[2] != 2), (selection->items[2] != 1));
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1: /* Selection-> */
|
2004-07-07 04:31:57 +04:00
|
|
|
switch (selection->items[1]) {
|
2004-12-09 13:30:44 +03:00
|
|
|
case 0: /* Edit-> */
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-12-09 13:30:44 +03:00
|
|
|
case 1: /* Launch */
|
|
|
|
ro_gui_tree_launch_selected(hotlist_tree);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-12-09 13:30:44 +03:00
|
|
|
case 2: /* Delete */
|
|
|
|
tree_delete_selected_nodes(hotlist_tree, hotlist_tree->root);
|
2004-07-07 04:31:57 +04:00
|
|
|
break;
|
2004-12-09 13:30:44 +03:00
|
|
|
case 3: /* Reset usage */
|
|
|
|
tree_reset_URL_nodes(hotlist_tree, hotlist_tree->root, true);
|
2004-07-07 04:31:57 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-07-06 02:17:59 +04:00
|
|
|
break;
|
|
|
|
case 2: /* Select all */
|
2004-12-09 13:30:44 +03:00
|
|
|
ro_gui_tree_keypress(1, hotlist_tree);
|
2004-07-16 23:47:03 +04:00
|
|
|
ro_gui_menu_prepare_hotlist();
|
2004-07-06 02:17:59 +04:00
|
|
|
break;
|
|
|
|
case 3: /* Clear */
|
2004-12-09 13:30:44 +03:00
|
|
|
ro_gui_tree_keypress(26, hotlist_tree);
|
2004-07-16 23:47:03 +04:00
|
|
|
ro_gui_menu_prepare_hotlist();
|
2004-07-06 02:17:59 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-02-09 02:37:41 +03:00
|
|
|
} else if (current_menu == global_history_menu) {
|
|
|
|
switch (selection->items[0]) {
|
|
|
|
case 0: /* Hotlist-> */
|
|
|
|
switch (selection->items[1]) {
|
|
|
|
case 0: /* Export */
|
|
|
|
break;
|
|
|
|
case 1: /* Expand */
|
|
|
|
tree_handle_expansion(global_history_tree, global_history_tree->root, true,
|
|
|
|
(selection->items[2] != 2), (selection->items[2] != 1));
|
|
|
|
break;
|
|
|
|
case 2: /* Collapse */
|
|
|
|
tree_handle_expansion(global_history_tree, global_history_tree->root, false,
|
|
|
|
(selection->items[2] != 2), (selection->items[2] != 1));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1: /* Selection-> */
|
|
|
|
switch (selection->items[1]) {
|
|
|
|
case 0: /* Launch */
|
|
|
|
ro_gui_tree_launch_selected(global_history_tree);
|
|
|
|
break;
|
|
|
|
case 1: /* Delete */
|
|
|
|
tree_delete_selected_nodes(global_history_tree, global_history_tree->root);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2: /* Select all */
|
|
|
|
ro_gui_tree_keypress(1, global_history_tree);
|
|
|
|
ro_gui_menu_prepare_global_history();
|
|
|
|
break;
|
|
|
|
case 3: /* Clear */
|
|
|
|
ro_gui_tree_keypress(26, global_history_tree);
|
|
|
|
ro_gui_menu_prepare_global_history();
|
|
|
|
break;
|
|
|
|
}
|
2003-08-22 01:39:07 +04:00
|
|
|
} else if (current_menu == browser_menu) {
|
2004-07-17 17:00:38 +04:00
|
|
|
struct content *c = current_gui->bw->current_content;
|
2003-08-22 01:39:07 +04:00
|
|
|
switch (selection->items[0]) {
|
2004-05-05 02:23:44 +04:00
|
|
|
case MENU_PAGE:
|
2003-08-22 01:39:07 +04:00
|
|
|
switch (selection->items[1]) {
|
|
|
|
case 0: /* Info */
|
|
|
|
break;
|
|
|
|
case 1: /* Save */
|
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case 2: /* Full save */
|
2003-08-22 01:39:07 +04:00
|
|
|
break;
|
2004-03-27 21:46:08 +03:00
|
|
|
case 3: /* Export */
|
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case 4: /* Save location */
|
2004-06-27 02:31:34 +04:00
|
|
|
switch (selection->items[2]) {
|
|
|
|
case 0: /* URI */
|
|
|
|
break;
|
|
|
|
case 1: /* URL */
|
|
|
|
break;
|
|
|
|
case 2: /* Text */
|
|
|
|
break;
|
|
|
|
}
|
2004-05-05 02:23:44 +04:00
|
|
|
break;
|
|
|
|
case 5: /* Print */
|
|
|
|
break;
|
2004-06-27 19:34:46 +04:00
|
|
|
case 6: /* New window */
|
2004-12-09 13:30:44 +03:00
|
|
|
browser_window_create(current_gui->bw->current_content->url,
|
|
|
|
current_gui->bw, 0);
|
2004-06-27 19:34:46 +04:00
|
|
|
break;
|
|
|
|
case 7: /* Page source */
|
2004-05-05 02:23:44 +04:00
|
|
|
ro_gui_view_source(c);
|
2003-08-22 01:39:07 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2004-05-05 04:02:13 +04:00
|
|
|
case MENU_OBJECT:
|
2004-07-18 21:38:01 +04:00
|
|
|
if (!gui_menu_object_box)
|
|
|
|
break;
|
2004-06-27 02:31:34 +04:00
|
|
|
switch (selection->items[1]) {
|
|
|
|
case 0: /* Info */
|
|
|
|
break;
|
|
|
|
case 1: /* Save */
|
|
|
|
break;
|
|
|
|
case 2: /* Export */
|
|
|
|
break;
|
|
|
|
case 3: /* Save Link */
|
|
|
|
switch (selection->items[2]) {
|
|
|
|
case 0: /* URI */
|
|
|
|
break;
|
|
|
|
case 1: /* URL */
|
|
|
|
break;
|
|
|
|
case 2: /* Text */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2004-06-29 21:26:42 +04:00
|
|
|
case 4: /* Reload */
|
|
|
|
ro_gui_menu_object_reload();
|
|
|
|
break;
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case MENU_SELECTION:
|
2003-08-22 01:39:07 +04:00
|
|
|
switch (selection->items[1]) {
|
|
|
|
case 0: /* Copy to clipboard */
|
|
|
|
ro_gui_copy_selection(current_gui);
|
|
|
|
break;
|
|
|
|
case 1: /* Select all */
|
|
|
|
break;
|
|
|
|
case 2: /* Clear */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case MENU_NAVIGATE:
|
2003-08-22 01:39:07 +04:00
|
|
|
switch (selection->items[1]) {
|
2004-05-05 02:23:44 +04:00
|
|
|
case 0: /* Home */
|
2004-08-06 03:10:24 +04:00
|
|
|
if (option_homepage_url && option_homepage_url[0]) {
|
2005-01-25 01:14:59 +03:00
|
|
|
browser_window_go(current_gui->bw, option_homepage_url, 0);
|
2004-08-06 03:10:24 +04:00
|
|
|
} else {
|
|
|
|
snprintf(url, sizeof url,
|
|
|
|
"file:/<NetSurf$Dir>/Docs/intro_%s",
|
|
|
|
option_language);
|
2005-01-25 01:14:59 +03:00
|
|
|
browser_window_go(current_gui->bw, url, 0);
|
2004-08-06 03:10:24 +04:00
|
|
|
}
|
2003-08-22 01:39:07 +04:00
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case 1: /* Back */
|
2004-07-17 17:00:38 +04:00
|
|
|
history_back(current_gui->bw,
|
|
|
|
current_gui->bw->history);
|
2004-06-27 02:31:34 +04:00
|
|
|
ro_gui_prepare_navigate(current_gui);
|
2003-08-22 01:39:07 +04:00
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case 2: /* Forward */
|
2004-07-17 17:00:38 +04:00
|
|
|
history_forward(current_gui->bw,
|
|
|
|
current_gui->bw->history);
|
2004-06-27 02:31:34 +04:00
|
|
|
ro_gui_prepare_navigate(current_gui);
|
2003-08-22 01:39:07 +04:00
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case 3: /* Reload */
|
2004-07-17 17:00:38 +04:00
|
|
|
browser_window_reload(current_gui->bw, false);
|
2004-06-27 02:31:34 +04:00
|
|
|
break;
|
|
|
|
case 4: /* Stop */
|
2004-07-17 17:00:38 +04:00
|
|
|
browser_window_stop(current_gui->bw);
|
2003-08-22 01:39:07 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case MENU_VIEW:
|
2004-04-13 23:04:32 +04:00
|
|
|
switch (selection->items[1]) {
|
|
|
|
case 0: /* Scale view */
|
2005-02-07 17:28:43 +03:00
|
|
|
ro_gui_menu_prepare_scale();
|
|
|
|
ro_gui_dialog_open_persistant(current_gui->window, dialog_zoom, false);
|
2004-04-13 23:04:32 +04:00
|
|
|
break;
|
|
|
|
case 1: /* Images -> */
|
2004-11-15 00:07:55 +03:00
|
|
|
switch (selection->items[2]) {
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
current_gui->option.background_images =
|
|
|
|
!current_gui->option.background_images;
|
|
|
|
break;
|
|
|
|
}
|
2004-11-03 02:23:07 +03:00
|
|
|
ro_gui_menu_prepare_images();
|
|
|
|
gui_window_redraw_window(current_gui);
|
2004-04-13 23:04:32 +04:00
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case 2: /* Toolbars -> */
|
|
|
|
switch (selection->items[2]) {
|
|
|
|
case 0:
|
2004-08-31 01:03:48 +04:00
|
|
|
current_gui->toolbar->display_buttons =
|
|
|
|
!current_gui->toolbar->display_buttons;
|
2004-05-05 02:23:44 +04:00
|
|
|
break;
|
|
|
|
case 1:
|
2004-08-31 01:03:48 +04:00
|
|
|
current_gui->toolbar->display_url =
|
|
|
|
!current_gui->toolbar->display_url;
|
2004-05-05 02:23:44 +04:00
|
|
|
break;
|
|
|
|
case 2:
|
2004-08-31 01:03:48 +04:00
|
|
|
current_gui->toolbar->display_throbber =
|
|
|
|
!current_gui->toolbar->display_throbber;
|
2004-05-05 02:23:44 +04:00
|
|
|
break;
|
|
|
|
case 3:
|
2004-08-31 01:03:48 +04:00
|
|
|
current_gui->toolbar->display_status =
|
|
|
|
!current_gui->toolbar->display_status;
|
2004-11-15 00:07:55 +03:00
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
}
|
2004-11-15 00:07:55 +03:00
|
|
|
ro_gui_menu_prepare_toolbars();
|
2004-08-31 01:03:48 +04:00
|
|
|
current_gui->toolbar->reformat_buttons = true;
|
|
|
|
height = current_gui->toolbar->height;
|
|
|
|
ro_gui_theme_process_toolbar(current_gui->toolbar, -1);
|
|
|
|
if (height != current_gui->toolbar->height)
|
|
|
|
ro_gui_window_update_dimensions(current_gui,
|
|
|
|
height - current_gui->toolbar->height);
|
2004-05-05 02:23:44 +04:00
|
|
|
break;
|
2004-07-21 00:02:59 +04:00
|
|
|
case 3: /* Render -> */
|
2004-11-15 00:07:55 +03:00
|
|
|
switch (selection->items[2]) {
|
|
|
|
case 0:
|
|
|
|
current_gui->option.background_blending =
|
|
|
|
!current_gui->option.background_blending;
|
|
|
|
gui_window_redraw_window(current_gui);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
current_gui->option.buffer_animations =
|
|
|
|
!current_gui->option.buffer_animations;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
current_gui->option.buffer_everything =
|
|
|
|
!current_gui->option.buffer_everything;
|
|
|
|
break;
|
2004-07-21 00:02:59 +04:00
|
|
|
}
|
|
|
|
ro_gui_menu_prepare_render();
|
|
|
|
break;
|
|
|
|
case 4: /* Make default */
|
2004-07-17 17:00:38 +04:00
|
|
|
ro_gui_window_default_options(current_gui->bw);
|
2004-07-12 23:55:49 +04:00
|
|
|
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 */
|
2004-12-09 13:30:44 +03:00
|
|
|
node = tree_create_URL_node(hotlist_tree->root,
|
|
|
|
messages_get(current_gui->title),
|
|
|
|
current_gui->bw->current_content->url,
|
|
|
|
ro_content_filetype(current_gui->bw->current_content),
|
|
|
|
time(NULL), -1, 0);
|
|
|
|
tree_redraw_area(hotlist_tree, node->box.x - NODE_INSTEP, 0,
|
|
|
|
NODE_INSTEP, 16384);
|
|
|
|
tree_handle_node_changed(hotlist_tree, node, false, true);
|
|
|
|
ro_gui_tree_scroll_visible(hotlist_tree, &node->data);
|
2004-07-12 23:55:49 +04:00
|
|
|
break;
|
2005-02-07 17:28:43 +03:00
|
|
|
case -1:
|
2004-07-12 23:55:49 +04:00
|
|
|
case 1: /* Show hotlist */
|
|
|
|
ro_gui_hotlist_show();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2005-02-07 17:28:43 +03:00
|
|
|
case 1: /* History -> */
|
|
|
|
switch (selection->items[2]) {
|
|
|
|
case -1:
|
|
|
|
case 0: /* Local history */
|
|
|
|
ro_gui_history_open(current_gui->bw,
|
|
|
|
current_gui->bw->history, false);
|
|
|
|
break;
|
|
|
|
case 1: /* Global history */
|
|
|
|
ro_gui_global_history_show();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2: /* Find Text -> */
|
|
|
|
#ifdef WITH_SEARCH
|
|
|
|
ro_gui_search_open(current_gui, 0, 0, false, true);
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case 3: /* Window -> */
|
2004-06-27 19:34:46 +04:00
|
|
|
switch (selection->items[2]) {
|
|
|
|
case 0:
|
2004-12-09 13:30:44 +03:00
|
|
|
ro_gui_screen_size(&option_window_screen_width,
|
|
|
|
&option_window_screen_height);
|
2005-02-07 17:28:43 +03:00
|
|
|
state.w = current_gui->window;
|
2004-06-27 19:34:46 +04:00
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_window_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
}
|
|
|
|
option_window_x = state.visible.x0;
|
|
|
|
option_window_y = state.visible.y0;
|
|
|
|
option_window_width = state.visible.x1 - state.visible.x0;
|
|
|
|
option_window_height = state.visible.y1 - state.visible.y0;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
option_window_stagger = !option_window_stagger;
|
|
|
|
break;
|
|
|
|
case 2:
|
2004-06-28 23:35:04 +04:00
|
|
|
option_window_size_clone = !option_window_size_clone;
|
|
|
|
break;
|
|
|
|
case 3:
|
2004-06-27 19:34:46 +04:00
|
|
|
option_window_screen_width = 0;
|
|
|
|
option_window_screen_height = 0;
|
|
|
|
break;
|
|
|
|
}
|
2005-02-07 17:28:43 +03:00
|
|
|
if (selection->items[2] >= 0)
|
|
|
|
ro_gui_save_options();
|
2004-06-27 19:34:46 +04:00
|
|
|
ro_gui_menu_prepare_window();
|
2004-05-23 16:22:05 +04:00
|
|
|
break;
|
2004-06-30 03:13:40 +04:00
|
|
|
}
|
|
|
|
break;
|
2004-05-05 02:23:44 +04:00
|
|
|
case MENU_HELP:
|
2004-04-13 23:04:32 +04:00
|
|
|
switch (selection->items[1]) {
|
2004-06-27 02:31:34 +04:00
|
|
|
case -1: /* No sub-item */
|
2004-04-13 23:04:32 +04:00
|
|
|
case 0: /* Contents */
|
2004-06-27 02:31:34 +04:00
|
|
|
ro_gui_open_help_page("docs");
|
|
|
|
break;
|
2004-04-13 23:04:32 +04:00
|
|
|
case 1: /* User guide -> */
|
2004-06-27 02:31:34 +04:00
|
|
|
ro_gui_open_help_page("guide");
|
2004-04-13 23:04:32 +04:00
|
|
|
break;
|
|
|
|
case 2: /* User information */
|
2004-06-27 02:31:34 +04:00
|
|
|
ro_gui_open_help_page("info");
|
2004-04-13 23:04:32 +04:00
|
|
|
break;
|
2004-06-11 16:19:57 +04:00
|
|
|
case 3: /* About NetSurf */
|
|
|
|
browser_window_create("file:/"
|
2004-10-02 01:31:55 +04:00
|
|
|
"<NetSurf$Dir>/Docs/about", 0, 0);
|
2004-06-11 16:19:57 +04:00
|
|
|
break;
|
|
|
|
case 4: /* Interactive help */
|
2004-05-14 23:59:09 +04:00
|
|
|
xos_cli("Filer_Run Resources:$.Apps.!Help");
|
|
|
|
ro_gui_menu_prepare_help(true);
|
2004-04-13 23:04:32 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
2004-07-27 19:49:28 +04:00
|
|
|
} else if (current_menu == proxyauth_menu) {
|
|
|
|
ro_gui_dialog_proxyauth_menu_selection(selection->items[0]);
|
2004-11-03 02:23:07 +03:00
|
|
|
} else if (current_menu == image_quality_menu) {
|
|
|
|
ro_gui_dialog_image_menu_selection(selection->items[0]);
|
2004-07-28 00:44:46 +04:00
|
|
|
} else if (current_menu == languages_menu) {
|
|
|
|
ro_gui_dialog_languages_menu_selection(languages_menu->entries[selection->items[0]].data.indirected_text.text);
|
2004-09-14 03:56:18 +04:00
|
|
|
} else if (current_menu == font_menu) {
|
|
|
|
ro_gui_font_menu_selection(selection);
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pointer.buttons == wimp_CLICK_ADJUST) {
|
2004-07-18 03:32:09 +04:00
|
|
|
if (current_menu == gui_form_select_menu)
|
|
|
|
gui_create_form_select_menu(current_gui->bw,
|
|
|
|
gui_form_select_control);
|
2003-08-22 01:39:07 +04:00
|
|
|
else
|
2004-07-18 03:32:09 +04:00
|
|
|
ro_gui_create_menu(current_menu,
|
|
|
|
current_menu_x, current_menu_y,
|
|
|
|
current_gui);
|
2004-07-04 22:44:51 +04:00
|
|
|
} else {
|
2004-12-09 13:30:44 +03:00
|
|
|
if (current_menu == hotlist_menu)
|
2004-07-04 22:44:51 +04:00
|
|
|
ro_gui_hotlist_menu_closed();
|
2005-02-07 17:28:43 +03:00
|
|
|
else if (current_menu == global_history_menu)
|
|
|
|
ro_gui_global_history_menu_closed();
|
2004-12-09 13:30:44 +03:00
|
|
|
current_menu = NULL;
|
|
|
|
current_gui = NULL;
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
}
|
2004-02-26 03:44:42 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2004-07-06 02:17:59 +04:00
|
|
|
* Handle Message_MenuWarning.
|
2004-02-26 03:44:42 +03:00
|
|
|
*/
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
void ro_gui_menu_warning(wimp_message_menu_warning *warning)
|
|
|
|
{
|
2004-07-11 17:05:38 +04:00
|
|
|
if (current_menu == browser_menu)
|
|
|
|
ro_gui_menu_browser_warning(warning);
|
|
|
|
else if (current_menu == hotlist_menu)
|
2004-07-06 02:17:59 +04:00
|
|
|
ro_gui_menu_hotlist_warning(warning);
|
2005-02-07 17:28:43 +03:00
|
|
|
else if (current_menu == global_history_menu)
|
|
|
|
ro_gui_menu_global_history_warning(warning);
|
2004-07-11 17:05:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle Message_MenuWarning for the browser menu.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning)
|
|
|
|
{
|
|
|
|
struct content *c;
|
|
|
|
struct box *box;
|
|
|
|
os_error *error = 0;
|
2004-07-06 02:17:59 +04:00
|
|
|
|
2004-07-17 17:00:38 +04:00
|
|
|
c = current_gui->bw->current_content;
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2004-04-13 23:04:32 +04:00
|
|
|
switch (warning->selection.items[0]) {
|
2004-07-11 17:05:38 +04:00
|
|
|
case MENU_PAGE: /* Page -> */
|
|
|
|
switch (warning->selection.items[1]) {
|
|
|
|
case 0: /* Page info */
|
|
|
|
ro_gui_menu_prepare_pageinfo();
|
|
|
|
error = xwimp_create_sub_menu(
|
|
|
|
(wimp_menu *) dialog_pageinfo,
|
2004-04-13 23:04:32 +04:00
|
|
|
warning->pos.x, warning->pos.y);
|
2004-03-27 21:53:17 +03:00
|
|
|
break;
|
2004-07-11 17:05:38 +04:00
|
|
|
|
|
|
|
case 1: /* Save */
|
|
|
|
ro_gui_save_open(GUI_SAVE_SOURCE, c, true,
|
2004-07-16 20:33:45 +04:00
|
|
|
warning->pos.x, warning->pos.y, 0, false);
|
2004-06-27 02:31:34 +04:00
|
|
|
break;
|
2004-07-11 17:05:38 +04:00
|
|
|
|
|
|
|
case 2: /* Save complete */
|
|
|
|
ro_gui_save_open(GUI_SAVE_COMPLETE, c, true,
|
2004-07-16 20:33:45 +04:00
|
|
|
warning->pos.x, warning->pos.y, 0, false);
|
2004-06-27 02:31:34 +04:00
|
|
|
break;
|
2004-07-11 17:05:38 +04:00
|
|
|
|
|
|
|
case 3: /* Export as -> */
|
|
|
|
switch (warning->selection.items[2]) {
|
|
|
|
case 0: /* Draw */
|
|
|
|
ro_gui_save_open(GUI_SAVE_DRAW, c, true,
|
|
|
|
warning->pos.x, warning->pos.y,
|
2004-07-16 20:33:45 +04:00
|
|
|
0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* Text */
|
|
|
|
ro_gui_save_open(GUI_SAVE_TEXT, c, true,
|
|
|
|
warning->pos.x, warning->pos.y,
|
2004-07-16 20:33:45 +04:00
|
|
|
0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-04-13 23:04:32 +04:00
|
|
|
}
|
2004-02-26 03:44:42 +03:00
|
|
|
break;
|
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
case 4: /* Save Link */
|
|
|
|
switch (warning->selection.items[2]) {
|
|
|
|
case 0: /* URI */
|
|
|
|
ro_gui_save_open(GUI_SAVE_LINK_URI, c, true,
|
|
|
|
warning->pos.x, warning->pos.y,
|
2004-07-16 20:33:45 +04:00
|
|
|
0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-03-27 21:46:08 +03:00
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
case 1: /* URL */
|
|
|
|
ro_gui_save_open(GUI_SAVE_LINK_URL, c, true,
|
|
|
|
warning->pos.x, warning->pos.y,
|
2004-07-16 20:33:45 +04:00
|
|
|
0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-03-27 21:46:08 +03:00
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
case 2: /* Text */
|
|
|
|
ro_gui_save_open(GUI_SAVE_LINK_TEXT, c, true,
|
|
|
|
warning->pos.x, warning->pos.y,
|
2004-07-16 20:33:45 +04:00
|
|
|
0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2004-08-09 10:28:57 +04:00
|
|
|
|
|
|
|
case 5: /* Print -> */
|
2004-09-14 03:56:18 +04:00
|
|
|
#ifdef WITH_PRINT
|
2004-08-09 10:28:57 +04:00
|
|
|
ro_gui_print_open(current_gui, warning->pos.x,
|
|
|
|
warning->pos.y, true, false);
|
2004-09-14 03:56:18 +04:00
|
|
|
#endif
|
2004-08-09 10:28:57 +04:00
|
|
|
break;
|
2004-07-12 23:55:49 +04:00
|
|
|
}
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_OBJECT: /* Object -> */
|
|
|
|
/** \todo this is really dumb, the object should be the one
|
|
|
|
* that the user clicked menu over, not the one that happens to
|
|
|
|
* be under the menu now */
|
2004-07-18 21:38:01 +04:00
|
|
|
box = gui_menu_object_box;
|
2004-07-11 17:05:38 +04:00
|
|
|
if (!box)
|
|
|
|
break;
|
2004-03-27 21:46:08 +03:00
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
switch (warning->selection.items[1]) {
|
|
|
|
case 0: /* Object info */
|
|
|
|
ro_gui_menu_objectinfo(warning);
|
|
|
|
return;
|
2004-07-06 02:17:59 +04:00
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
case 1: /* Save */
|
|
|
|
ro_gui_save_open(GUI_SAVE_OBJECT_ORIG, box->object,
|
|
|
|
true,
|
2004-07-16 20:33:45 +04:00
|
|
|
warning->pos.x, warning->pos.y, 0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* Export */
|
|
|
|
switch (warning->selection.items[2]) {
|
|
|
|
case 0: /* Sprite */
|
|
|
|
ro_gui_save_open(GUI_SAVE_OBJECT_NATIVE,
|
|
|
|
box->object, true,
|
|
|
|
warning->pos.x, warning->pos.y,
|
2004-07-16 20:33:45 +04:00
|
|
|
0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
|
|
|
break;
|
2004-07-11 17:05:38 +04:00
|
|
|
|
|
|
|
case 3: /* Save Link */
|
|
|
|
switch (warning->selection.items[2]) {
|
|
|
|
case 0: /* URI */
|
|
|
|
ro_gui_save_open(GUI_SAVE_LINK_URI,
|
|
|
|
box->object, true,
|
|
|
|
warning->pos.x, warning->pos.y,
|
2004-07-16 20:33:45 +04:00
|
|
|
0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* URL */
|
|
|
|
ro_gui_save_open(GUI_SAVE_LINK_URL,
|
|
|
|
box->object, true,
|
|
|
|
warning->pos.x, warning->pos.y,
|
2004-07-16 20:33:45 +04:00
|
|
|
0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* Text */
|
|
|
|
ro_gui_save_open(GUI_SAVE_LINK_TEXT,
|
|
|
|
box->object, true,
|
|
|
|
warning->pos.x, warning->pos.y,
|
2004-07-16 20:33:45 +04:00
|
|
|
0, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
break;
|
2004-07-07 04:31:57 +04:00
|
|
|
}
|
2004-07-06 02:17:59 +04:00
|
|
|
break;
|
2004-07-11 17:05:38 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_NAVIGATE: /* Navigate -> */
|
|
|
|
ro_gui_prepare_navigate(current_gui);
|
|
|
|
error = xwimp_create_sub_menu(browser_navigate_menu,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_VIEW: /* View -> */
|
|
|
|
switch (warning->selection.items[1]) {
|
2004-11-15 00:07:55 +03:00
|
|
|
case -1: /* View-> */
|
|
|
|
ro_gui_menu_prepare_view();
|
2005-01-02 01:05:21 +03:00
|
|
|
if (current_gui->toolbar)
|
2004-11-15 00:07:55 +03:00
|
|
|
view_menu.entries[2].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
else
|
|
|
|
view_menu.entries[2].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
error = xwimp_create_sub_menu((wimp_menu *) browser_view_menu,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
|
|
|
case 0: /* Scale view -> */
|
|
|
|
ro_gui_menu_prepare_scale();
|
|
|
|
error = xwimp_create_sub_menu((wimp_menu *) dialog_zoom,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
2005-01-02 01:05:21 +03:00
|
|
|
|
2004-11-15 00:07:55 +03:00
|
|
|
case 1: /* Images -> */
|
|
|
|
ro_gui_menu_prepare_images();
|
|
|
|
error = xwimp_create_sub_menu(browser_image_menu,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
|
|
|
case 2: /* Toolbars -> */
|
|
|
|
ro_gui_menu_prepare_toolbars();
|
|
|
|
error = xwimp_create_sub_menu(browser_toolbar_menu,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
|
|
|
case 3: /* Render -> */
|
|
|
|
ro_gui_menu_prepare_render();
|
|
|
|
error = xwimp_create_sub_menu(browser_render_menu,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
2004-07-12 23:55:49 +04:00
|
|
|
}
|
|
|
|
break;
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2004-07-12 23:55:49 +04:00
|
|
|
case MENU_UTILITIES:
|
|
|
|
switch (warning->selection.items[1]) {
|
|
|
|
case 0: /* Hotlist -> */
|
2005-02-07 17:28:43 +03:00
|
|
|
case 1: /* History -> */
|
2004-08-07 05:43:43 +04:00
|
|
|
break;
|
|
|
|
case 2: /* Find text -> */
|
2004-09-14 03:56:18 +04:00
|
|
|
#ifdef WITH_SEARCH
|
2004-08-07 05:43:43 +04:00
|
|
|
ro_gui_search_open(current_gui,
|
|
|
|
warning->pos.x,
|
|
|
|
warning->pos.y,
|
|
|
|
true,
|
|
|
|
false);
|
2005-02-07 17:28:43 +03:00
|
|
|
break;
|
2004-09-14 03:56:18 +04:00
|
|
|
#endif
|
2005-02-07 17:28:43 +03:00
|
|
|
case 3: /* Window -> */
|
|
|
|
ro_gui_menu_prepare_window();
|
|
|
|
error = xwimp_create_sub_menu(browser_window_menu,
|
|
|
|
warning->pos.x, warning->pos.y);
|
2004-08-07 05:43:43 +04:00
|
|
|
break;
|
2004-07-11 17:05:38 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_HELP: /* Help -> */
|
|
|
|
ro_gui_menu_prepare_help(false);
|
|
|
|
error = xwimp_create_sub_menu(browser_help_menu,
|
|
|
|
warning->pos.x, warning->pos.y);
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2004-07-06 02:17:59 +04:00
|
|
|
if (error) {
|
2004-07-11 17:05:38 +04:00
|
|
|
LOG(("xwimp_create_sub_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
2004-07-06 02:17:59 +04:00
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-27 21:46:08 +03:00
|
|
|
/**
|
2004-07-11 17:05:38 +04:00
|
|
|
* Handle Message_MenuWarning for the hotlist menu.
|
2004-03-27 21:46:08 +03:00
|
|
|
*/
|
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
void ro_gui_menu_hotlist_warning(wimp_message_menu_warning *warning)
|
2004-03-27 21:46:08 +03:00
|
|
|
{
|
2004-12-09 13:30:44 +03:00
|
|
|
os_error *error = NULL;
|
|
|
|
struct node *node;
|
2004-07-06 02:17:59 +04:00
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
switch (warning->selection.items[0]) {
|
2004-12-09 13:30:44 +03:00
|
|
|
case 0: /* Hotlist-> */
|
|
|
|
switch (warning->selection.items[1]) {
|
|
|
|
case 0: /* New-> */
|
|
|
|
switch (warning->selection.items[2]) {
|
|
|
|
case 0: /* Folder */
|
|
|
|
ro_gui_hotlist_prepare_folder_dialog(NULL);
|
|
|
|
error = xwimp_create_sub_menu(
|
|
|
|
(wimp_menu *) dialog_folder,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
|
|
|
case 1: /* Entry */
|
|
|
|
ro_gui_hotlist_prepare_entry_dialog(NULL);
|
|
|
|
error = xwimp_create_sub_menu(
|
|
|
|
(wimp_menu *) dialog_entry,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1: /* Export-> */
|
|
|
|
ro_gui_save_open(GUI_SAVE_HOTLIST_EXPORT_HTML, 0, true,
|
|
|
|
warning->pos.x, warning->pos.y, 0, false);
|
|
|
|
break;
|
2004-07-22 00:02:13 +04:00
|
|
|
}
|
2004-06-27 02:31:34 +04:00
|
|
|
break;
|
2004-12-09 13:30:44 +03:00
|
|
|
case 1: /* Selection-> */
|
|
|
|
switch (warning->selection.items[1]) {
|
|
|
|
case -1: /* Root */
|
|
|
|
ro_gui_menu_prepare_hotlist();
|
|
|
|
error = xwimp_create_sub_menu(hotlist_select_menu,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
|
|
|
case 0: /* Edit-> */
|
|
|
|
node = tree_get_selected_node(hotlist_tree->root);
|
|
|
|
if (!node)
|
|
|
|
break;
|
|
|
|
if (node->folder) {
|
|
|
|
ro_gui_hotlist_prepare_folder_dialog(node);
|
|
|
|
error = xwimp_create_sub_menu(
|
|
|
|
(wimp_menu *) dialog_folder,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
} else {
|
|
|
|
ro_gui_hotlist_prepare_entry_dialog(node);
|
|
|
|
error = xwimp_create_sub_menu(
|
|
|
|
(wimp_menu *) dialog_entry,
|
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
}
|
|
|
|
break;
|
2004-07-11 17:05:38 +04:00
|
|
|
}
|
2004-07-06 02:17:59 +04:00
|
|
|
break;
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
2004-03-27 21:46:08 +03:00
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_sub_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
2004-07-04 18:59:29 +04:00
|
|
|
}
|
2004-03-27 21:46:08 +03:00
|
|
|
}
|
2004-04-03 06:59:35 +04:00
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/**
|
|
|
|
* Handle Message_MenuWarning for the global history menu.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_menu_global_history_warning(wimp_message_menu_warning *warning)
|
|
|
|
{
|
|
|
|
os_error *error = NULL;
|
|
|
|
|
|
|
|
switch (warning->selection.items[0]) {
|
|
|
|
case 0: /* History-> */
|
|
|
|
switch (warning->selection.items[1]) {
|
|
|
|
case 0: /* Export-> */
|
|
|
|
ro_gui_save_open(GUI_SAVE_HISTORY_EXPORT_HTML, 0, true,
|
|
|
|
warning->pos.x, warning->pos.y, 0, false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1: /* Selection-> */
|
|
|
|
switch (warning->selection.items[1]) {
|
|
|
|
case -1: /* Root */
|
|
|
|
ro_gui_menu_prepare_global_history();
|
2005-02-09 02:37:41 +03:00
|
|
|
error = xwimp_create_sub_menu(history_select_menu,
|
2005-02-07 17:28:43 +03:00
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_sub_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-27 02:31:34 +04:00
|
|
|
/**
|
|
|
|
* Update navigate menu status and toolbar icons.
|
|
|
|
*
|
|
|
|
* /param gui_window the gui_window to update
|
|
|
|
*/
|
2004-07-17 17:00:38 +04:00
|
|
|
void ro_gui_prepare_navigate(struct gui_window *gui) {
|
2004-06-27 19:34:46 +04:00
|
|
|
struct browser_window *bw;
|
2004-06-27 02:31:34 +04:00
|
|
|
struct history *h;
|
|
|
|
struct content *c;
|
|
|
|
struct toolbar *t;
|
|
|
|
bool update_menu = ((current_menu == browser_menu) && (current_gui == gui));
|
2004-06-27 03:10:51 +04:00
|
|
|
int menu_changed = 0;
|
|
|
|
unsigned int i;
|
2005-02-07 17:28:43 +03:00
|
|
|
int suggestions;
|
2004-06-27 03:10:51 +04:00
|
|
|
wimp_selection selection;
|
2004-06-29 21:26:42 +04:00
|
|
|
|
2004-06-27 02:31:34 +04:00
|
|
|
if (!gui) {
|
2004-06-27 19:34:46 +04:00
|
|
|
LOG(("Attempt to update a NULL gui_window icon status"));
|
2004-06-27 02:31:34 +04:00
|
|
|
return;
|
|
|
|
}
|
2004-06-29 21:26:42 +04:00
|
|
|
|
2004-06-27 02:31:34 +04:00
|
|
|
/* Get the data we need to work with
|
|
|
|
*/
|
2004-07-17 17:00:38 +04:00
|
|
|
bw = gui->bw;
|
2004-06-27 02:31:34 +04:00
|
|
|
h = bw->history;
|
|
|
|
c = bw->current_content;
|
2004-07-17 17:00:38 +04:00
|
|
|
t = gui->toolbar;
|
2004-06-29 21:26:42 +04:00
|
|
|
|
2004-06-27 03:10:51 +04:00
|
|
|
/* Get the initial menu state to check for changes
|
|
|
|
*/
|
|
|
|
if (update_menu) {
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
if (browser_navigate_menu->entries[i].icon_flags & wimp_ICON_SHADED) {
|
|
|
|
menu_changed += (1 << i);
|
|
|
|
}
|
|
|
|
}
|
2004-09-02 00:57:25 +04:00
|
|
|
if (menu.entries[0].icon_flags & wimp_ICON_SHADED) menu_changed += (1 << 4);
|
2004-06-27 03:10:51 +04:00
|
|
|
}
|
2004-06-27 02:31:34 +04:00
|
|
|
|
|
|
|
/* Update the back/forwards icons/buttons
|
|
|
|
*/
|
|
|
|
if (update_menu) {
|
|
|
|
if (history_back_available(h)) {
|
|
|
|
browser_navigate_menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
} else {
|
|
|
|
browser_navigate_menu->entries[1].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
}
|
|
|
|
if (history_forward_available(h)) {
|
|
|
|
browser_navigate_menu->entries[2].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
} else {
|
2004-06-29 21:26:42 +04:00
|
|
|
browser_navigate_menu->entries[2].icon_flags |= wimp_ICON_SHADED;
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (t) {
|
|
|
|
if (h) {
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_BACK,
|
|
|
|
!history_back_available(h));
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_FORWARD,
|
|
|
|
!history_forward_available(h));
|
2004-09-02 00:57:25 +04:00
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_HISTORY,
|
|
|
|
!(c || history_back_available(h) || history_forward_available(h)));
|
2004-06-29 21:26:42 +04:00
|
|
|
|
2004-09-02 00:57:25 +04:00
|
|
|
} else {
|
2004-06-27 02:31:34 +04:00
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_BACK, true);
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_FORWARD, true);
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_HISTORY, true);
|
|
|
|
}
|
2004-12-09 13:30:44 +03:00
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_BOOKMARK, !hotlist_tree);
|
2005-02-07 17:28:43 +03:00
|
|
|
global_history_get_recent(&suggestions);
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_SUGGEST, (suggestions <= 0));
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the stop/refresh icons/buttons
|
|
|
|
*/
|
2004-09-02 00:57:25 +04:00
|
|
|
if (bw->current_content && !bw->loading_content) {
|
2004-06-27 02:31:34 +04:00
|
|
|
if (update_menu) browser_navigate_menu->entries[3].icon_flags &= ~wimp_ICON_SHADED;
|
2004-09-02 00:57:25 +04:00
|
|
|
if (t) ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_RELOAD, false);
|
|
|
|
} else {
|
|
|
|
if (update_menu) browser_navigate_menu->entries[3].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
if (t) ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_RELOAD, true);
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
2004-09-02 00:57:25 +04:00
|
|
|
if (bw->loading_content || (bw->current_content &&
|
|
|
|
bw->current_content->status != CONTENT_STATUS_DONE)) {
|
2004-06-27 02:31:34 +04:00
|
|
|
if (update_menu) browser_navigate_menu->entries[4].icon_flags &= ~wimp_ICON_SHADED;
|
2004-09-02 00:57:25 +04:00
|
|
|
if (t) ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_STOP, false);
|
2004-06-27 02:31:34 +04:00
|
|
|
} else {
|
|
|
|
if (update_menu) browser_navigate_menu->entries[4].icon_flags |= wimp_ICON_SHADED;
|
2004-09-02 00:57:25 +04:00
|
|
|
if (t) ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_STOP, true);
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
2004-06-27 03:10:51 +04:00
|
|
|
|
2004-09-02 00:57:25 +04:00
|
|
|
/* Set the scale view icon
|
|
|
|
*/
|
|
|
|
if (c) {
|
2004-10-05 03:54:42 +04:00
|
|
|
if (update_menu) menu.entries[0].icon_flags &= ~wimp_ICON_SHADED;
|
2004-09-02 00:57:25 +04:00
|
|
|
if (t) {
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_SEARCH, false);
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_SCALE, false);
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_SAVE, false);
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_PRINT, false);
|
|
|
|
}
|
|
|
|
} else {
|
2004-10-05 03:54:42 +04:00
|
|
|
if (update_menu) menu.entries[0].icon_flags |= wimp_ICON_SHADED;
|
2004-09-02 00:57:25 +04:00
|
|
|
if (t) {
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_SEARCH, true);
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_SCALE, true);
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_SAVE, true);
|
|
|
|
ro_gui_set_icon_shaded_state(t->toolbar_handle, ICON_TOOLBAR_PRINT, true);
|
|
|
|
}
|
|
|
|
}
|
2004-06-29 21:26:42 +04:00
|
|
|
|
2004-06-27 03:10:51 +04:00
|
|
|
/* Check if we've changed our menu state
|
|
|
|
*/
|
|
|
|
if (update_menu) {
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
if (browser_navigate_menu->entries[i].icon_flags & wimp_ICON_SHADED) {
|
|
|
|
menu_changed -= (1 << i);
|
|
|
|
}
|
|
|
|
}
|
2004-09-02 00:57:25 +04:00
|
|
|
if (menu.entries[0].icon_flags & wimp_ICON_SHADED) menu_changed -= (1 << 4);
|
2004-06-29 21:26:42 +04:00
|
|
|
|
2004-06-27 03:10:51 +04:00
|
|
|
/* Re-open the submenu
|
|
|
|
*/
|
|
|
|
if (menu_changed != 0) {
|
2004-06-27 19:34:46 +04:00
|
|
|
if (!xwimp_get_menu_state((wimp_menu_state_flags)0, &selection,
|
|
|
|
(wimp_w)0, (wimp_i)0)) {
|
|
|
|
if (selection.items[0] == MENU_NAVIGATE) {
|
|
|
|
ro_gui_create_menu(current_menu, 0, 0, current_gui);
|
|
|
|
}
|
2004-06-29 21:26:42 +04:00
|
|
|
|
2004-06-27 19:34:46 +04:00
|
|
|
}
|
2004-06-27 03:10:51 +04:00
|
|
|
}
|
|
|
|
}
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-04-13 23:04:32 +04:00
|
|
|
/**
|
|
|
|
* Update image menu status
|
|
|
|
*/
|
|
|
|
static void ro_gui_menu_prepare_images(void) {
|
|
|
|
if (current_menu != browser_menu) return;
|
2004-04-25 03:42:32 +04:00
|
|
|
|
2004-07-21 00:02:59 +04:00
|
|
|
/* Set the options according to the local values
|
2004-04-13 23:04:32 +04:00
|
|
|
*/
|
2004-06-11 02:11:44 +04:00
|
|
|
browser_image_menu->entries[1].menu_flags &= ~wimp_MENU_TICKED;
|
2004-07-17 17:00:38 +04:00
|
|
|
if (current_gui->option.background_images) browser_image_menu->entries[1].menu_flags |= wimp_MENU_TICKED;
|
2004-05-05 02:23:44 +04:00
|
|
|
browser_image_menu->entries[2].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
|
2004-04-13 23:04:32 +04:00
|
|
|
|
2004-07-21 00:02:59 +04:00
|
|
|
/**
|
|
|
|
* Update render menu status
|
|
|
|
*/
|
|
|
|
static void ro_gui_menu_prepare_render(void) {
|
|
|
|
if (current_menu != browser_menu) return;
|
|
|
|
|
|
|
|
/* Set the options according to the local values
|
|
|
|
*/
|
|
|
|
browser_render_menu->entries[1].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
browser_render_menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
browser_render_menu->entries[2].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
if (current_gui->option.background_blending) {
|
|
|
|
browser_render_menu->entries[0].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
browser_render_menu->entries[0].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
if (current_gui->option.buffer_everything) {
|
|
|
|
browser_render_menu->entries[1].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
browser_render_menu->entries[1].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
browser_render_menu->entries[2].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
browser_render_menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
browser_render_menu->entries[2].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
if (current_gui->option.buffer_animations) {
|
|
|
|
browser_render_menu->entries[1].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
browser_render_menu->entries[1].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-27 19:34:46 +04:00
|
|
|
/**
|
|
|
|
* Update window menu status
|
|
|
|
*/
|
|
|
|
static void ro_gui_menu_prepare_window(void) {
|
|
|
|
if (current_menu != browser_menu) return;
|
|
|
|
|
|
|
|
/* Check if we can reset
|
|
|
|
*/
|
|
|
|
if ((option_window_screen_width != 0) && (option_window_screen_height != 0)) {
|
|
|
|
browser_window_menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
|
2004-06-28 23:35:04 +04:00
|
|
|
browser_window_menu->entries[3].icon_flags &= ~wimp_ICON_SHADED;
|
2004-06-29 21:26:42 +04:00
|
|
|
|
2004-06-27 19:34:46 +04:00
|
|
|
/* Check if we are staggered
|
|
|
|
*/
|
|
|
|
if (option_window_stagger) {
|
|
|
|
browser_window_menu->entries[1].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
browser_window_menu->entries[1].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
browser_window_menu->entries[1].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
browser_window_menu->entries[1].icon_flags |= wimp_ICON_SHADED;
|
2004-06-28 23:35:04 +04:00
|
|
|
browser_window_menu->entries[3].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
}
|
2004-06-29 21:26:42 +04:00
|
|
|
|
2004-06-28 23:35:04 +04:00
|
|
|
/* Set if we are cloing the window size
|
|
|
|
*/
|
|
|
|
if (option_window_size_clone) {
|
|
|
|
browser_window_menu->entries[2].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
browser_window_menu->entries[2].menu_flags &= ~wimp_MENU_TICKED;
|
2004-06-27 19:34:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
/**
|
|
|
|
* Update toolbar menu status
|
|
|
|
*/
|
|
|
|
static void ro_gui_menu_prepare_theme(void) {
|
|
|
|
struct toolbar_icon *icon;
|
|
|
|
struct toolbar_icon *next;
|
|
|
|
wimp_menu *sub_menu;
|
2005-01-02 01:05:21 +03:00
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
if (!current_toolbar) return;
|
2005-01-02 01:05:21 +03:00
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
/* Set the icon states
|
|
|
|
*/
|
|
|
|
if (current_toolbar->display_buttons) {
|
|
|
|
toolbar_menu->entries[0].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
toolbar_menu->entries[2].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
toolbar_menu->entries[3].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
if (current_toolbar->type == THEME_BROWSER_TOOLBAR) {
|
|
|
|
toolbar_menu->entries[0].sub_menu = toolbar_browser_menu;
|
|
|
|
} else if (current_toolbar->type == THEME_HOTLIST_TOOLBAR) {
|
|
|
|
toolbar_menu->entries[0].sub_menu = toolbar_hotlist_menu;
|
|
|
|
} else {
|
|
|
|
LOG(("Unknown toolbar type"));
|
|
|
|
return; /* unknown toolbar type */
|
|
|
|
}
|
|
|
|
sub_menu = toolbar_menu->entries[0].sub_menu;
|
|
|
|
next = current_toolbar->icon;
|
|
|
|
while ((icon = next) != NULL) {
|
|
|
|
next = icon->next;
|
|
|
|
if (icon->icon_number >= 0) {
|
|
|
|
if (icon->width == 0) {
|
|
|
|
sub_menu->entries[icon->icon_number].icon_flags |=
|
|
|
|
wimp_ICON_SHADED;
|
|
|
|
sub_menu->entries[icon->icon_number].menu_flags &=
|
|
|
|
~wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
if (icon->display) {
|
|
|
|
sub_menu->entries[icon->icon_number].menu_flags |=
|
|
|
|
wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
sub_menu->entries[icon->icon_number].menu_flags &=
|
|
|
|
~wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
toolbar_menu->entries[0].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
toolbar_menu->entries[2].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
toolbar_menu->entries[3].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
}
|
2005-01-02 01:05:21 +03:00
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
/* Set the toolbars submenu state
|
|
|
|
*/
|
|
|
|
if (current_gui) {
|
|
|
|
toolbar_menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
ro_gui_menu_prepare_toolbars();
|
|
|
|
} else {
|
|
|
|
toolbar_menu->entries[1].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the locked state
|
|
|
|
*/
|
|
|
|
if (current_toolbar->locked) {
|
|
|
|
toolbar_menu->entries[4].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
toolbar_menu->entries[4].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
/**
|
|
|
|
* Update toolbar menu status
|
|
|
|
*/
|
|
|
|
static void ro_gui_menu_prepare_toolbars(void) {
|
2004-06-27 02:31:34 +04:00
|
|
|
int index;
|
|
|
|
struct toolbar *toolbar;
|
2004-04-13 23:04:32 +04:00
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
/* Check we have a toolbar
|
|
|
|
*/
|
2004-10-05 03:54:42 +04:00
|
|
|
if (!current_gui) return;
|
2004-07-17 17:00:38 +04:00
|
|
|
toolbar = current_gui->toolbar;
|
2004-05-05 02:23:44 +04:00
|
|
|
|
|
|
|
/* Set our ticks, or shade everything if there's no toolbar
|
|
|
|
*/
|
|
|
|
if (toolbar) {
|
|
|
|
for (index = 0; index < 4; index++) {
|
|
|
|
browser_toolbar_menu->entries[index].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
browser_toolbar_menu->entries[index].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
}
|
2004-10-05 03:54:42 +04:00
|
|
|
if ((toolbar->descriptor) && (toolbar->descriptor->theme)) {
|
2004-09-08 03:05:34 +04:00
|
|
|
if (toolbar->display_buttons) browser_toolbar_menu->entries[0].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
if (toolbar->display_throbber) browser_toolbar_menu->entries[2].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
for (index = 0; index < 3; index += 2) {
|
|
|
|
browser_toolbar_menu->entries[index].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
browser_toolbar_menu->entries[index].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
}
|
2004-08-31 01:03:48 +04:00
|
|
|
if (toolbar->display_url) browser_toolbar_menu->entries[1].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
if (toolbar->display_status) browser_toolbar_menu->entries[3].menu_flags |= wimp_MENU_TICKED;
|
2004-05-05 02:23:44 +04:00
|
|
|
} else {
|
|
|
|
for (index = 0; index < 4; index++) {
|
|
|
|
browser_toolbar_menu->entries[index].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
browser_toolbar_menu->entries[index].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update scale to current document value
|
|
|
|
*/
|
|
|
|
void ro_gui_menu_prepare_scale(void) {
|
2004-06-27 02:31:34 +04:00
|
|
|
char scale_buffer[8];
|
2004-07-17 17:00:38 +04:00
|
|
|
sprintf(scale_buffer, "%.0f", current_gui->option.scale * 100);
|
2004-05-05 02:23:44 +04:00
|
|
|
ro_gui_set_icon_string(dialog_zoom, ICON_ZOOM_VALUE, scale_buffer);
|
2004-08-07 03:45:21 +04:00
|
|
|
ro_gui_current_zoom_gui = current_gui;
|
2004-04-13 23:04:32 +04:00
|
|
|
}
|
2004-07-07 04:31:57 +04:00
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
|
2004-07-07 04:31:57 +04:00
|
|
|
/**
|
|
|
|
* Update hotlist menu (all of)
|
|
|
|
*/
|
|
|
|
void ro_gui_menu_prepare_hotlist(void) {
|
2004-12-09 13:30:44 +03:00
|
|
|
os_error *error;
|
|
|
|
bool reopen = false;
|
|
|
|
bool selection = false;
|
|
|
|
struct node *single = NULL;
|
|
|
|
|
|
|
|
if (hotlist_tree->root->child) {
|
|
|
|
single = tree_get_selected_node(hotlist_tree->root->child);
|
|
|
|
selection = tree_has_selection(hotlist_tree->root->child);
|
2005-02-07 17:28:43 +03:00
|
|
|
hotlist_menu->entries[2].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
hotlist_file_menu->entries[2].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
hotlist_file_menu->entries[3].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
} else {
|
|
|
|
hotlist_menu->entries[2].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
hotlist_file_menu->entries[2].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
hotlist_file_menu->entries[3].icon_flags &= wimp_ICON_SHADED;
|
2004-12-09 13:30:44 +03:00
|
|
|
}
|
2005-02-07 17:28:43 +03:00
|
|
|
ro_gui_set_icon_shaded_state(hotlist_toolbar->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_OPEN, !hotlist_tree->root->child);
|
|
|
|
ro_gui_set_icon_shaded_state(hotlist_toolbar->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_EXPAND, !hotlist_tree->root->child);
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2004-07-27 02:23:40 +04:00
|
|
|
if (hotlist_toolbar) {
|
|
|
|
ro_gui_set_icon_shaded_state(hotlist_toolbar->toolbar_handle,
|
2004-12-09 13:30:44 +03:00
|
|
|
ICON_TOOLBAR_DELETE, !selection);
|
2004-07-27 02:23:40 +04:00
|
|
|
ro_gui_set_icon_shaded_state(hotlist_toolbar->toolbar_handle,
|
2004-12-09 13:30:44 +03:00
|
|
|
ICON_TOOLBAR_LAUNCH, !selection);
|
2004-07-27 02:23:40 +04:00
|
|
|
}
|
2004-12-09 13:30:44 +03:00
|
|
|
|
|
|
|
if (selection) {
|
|
|
|
reopen |= (hotlist_menu->entries[1].icon_flags & wimp_ICON_SHADED);
|
2004-07-07 04:31:57 +04:00
|
|
|
hotlist_menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
hotlist_menu->entries[3].icon_flags &= ~wimp_ICON_SHADED;
|
2004-07-09 02:05:35 +04:00
|
|
|
} else {
|
2004-12-09 13:30:44 +03:00
|
|
|
reopen |= !(hotlist_menu->entries[1].icon_flags & wimp_ICON_SHADED);
|
|
|
|
hotlist_menu->entries[1].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
hotlist_menu->entries[3].icon_flags |= wimp_ICON_SHADED;
|
2004-07-07 04:31:57 +04:00
|
|
|
}
|
2004-12-09 13:30:44 +03:00
|
|
|
|
|
|
|
if (single) {
|
|
|
|
reopen |= (hotlist_select_menu->entries[0].icon_flags & wimp_ICON_SHADED);
|
|
|
|
hotlist_select_menu->entries[0].icon_flags &= ~wimp_ICON_SHADED;
|
2004-07-09 02:05:35 +04:00
|
|
|
} else {
|
2004-12-09 13:30:44 +03:00
|
|
|
reopen |= !(hotlist_select_menu->entries[0].icon_flags & wimp_ICON_SHADED);
|
|
|
|
hotlist_select_menu->entries[0].icon_flags |= wimp_ICON_SHADED;
|
2004-07-09 02:05:35 +04:00
|
|
|
}
|
2004-12-09 13:30:44 +03:00
|
|
|
|
|
|
|
if ((reopen) && (current_menu == hotlist_menu)) {
|
|
|
|
error = xwimp_create_menu(hotlist_menu, 0, 0);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
}
|
2004-07-07 04:31:57 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/**
|
|
|
|
* Update global history menu (all of)
|
|
|
|
*/
|
|
|
|
void ro_gui_menu_prepare_global_history(void) {
|
|
|
|
os_error *error;
|
|
|
|
bool reopen = false;
|
|
|
|
bool selection = false;
|
|
|
|
|
|
|
|
if (global_history_tree->root->child) {
|
|
|
|
selection = tree_has_selection(global_history_tree->root->child);
|
|
|
|
global_history_menu->entries[2].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
history_file_menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
history_file_menu->entries[2].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
} else {
|
|
|
|
global_history_menu->entries[2].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
history_file_menu->entries[1].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
history_file_menu->entries[2].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
}
|
|
|
|
ro_gui_set_icon_shaded_state(global_history_toolbar->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_OPEN, !global_history_tree->root->child);
|
|
|
|
ro_gui_set_icon_shaded_state(global_history_toolbar->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_EXPAND, !global_history_tree->root->child);
|
|
|
|
|
|
|
|
if (hotlist_toolbar) {
|
|
|
|
ro_gui_set_icon_shaded_state(global_history_toolbar->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_DELETE, !selection);
|
|
|
|
ro_gui_set_icon_shaded_state(global_history_toolbar->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_LAUNCH, !selection);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selection) {
|
|
|
|
reopen |= (global_history_menu->entries[1].icon_flags & wimp_ICON_SHADED);
|
|
|
|
global_history_menu->entries[1].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
global_history_menu->entries[3].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
} else {
|
|
|
|
reopen |= !(global_history_menu->entries[1].icon_flags & wimp_ICON_SHADED);
|
|
|
|
global_history_menu->entries[1].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
global_history_menu->entries[3].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((reopen) && (current_menu == global_history_menu)) {
|
|
|
|
error = xwimp_create_menu(global_history_menu, 0, 0);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-14 23:59:09 +04:00
|
|
|
/**
|
|
|
|
* Update the Interactive Help status
|
|
|
|
*
|
|
|
|
* \parmam force force the status to be disabled
|
|
|
|
*/
|
|
|
|
void ro_gui_menu_prepare_help(int forced) {
|
|
|
|
if (ro_gui_interactive_help_available() || (forced)) {
|
2004-06-11 16:19:57 +04:00
|
|
|
browser_help_menu->entries[4].icon_flags |= wimp_ICON_SHADED;
|
2004-05-14 23:59:09 +04:00
|
|
|
} else {
|
2004-06-11 16:19:57 +04:00
|
|
|
browser_help_menu->entries[4].icon_flags &= ~wimp_ICON_SHADED;
|
2004-05-14 23:59:09 +04:00
|
|
|
}
|
|
|
|
}
|
2004-04-13 23:04:32 +04:00
|
|
|
|
2004-09-02 00:57:25 +04:00
|
|
|
void ro_gui_menu_prepare_view(void) {
|
|
|
|
if (current_gui->toolbar) {
|
|
|
|
view_menu.entries[2].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
} else {
|
|
|
|
view_menu.entries[2].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
}
|
|
|
|
if ((current_gui->bw) && (current_gui->bw->current_content)) {
|
|
|
|
view_menu.entries[0].icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
} else {
|
|
|
|
view_menu.entries[0].icon_flags |= wimp_ICON_SHADED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-11-03 02:23:07 +03:00
|
|
|
void ro_gui_menu_prepare_image_quality(unsigned int tinct_options) {
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
image_quality_menu->entries[i].menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
if (tinct_options & tinct_USE_OS_SPRITE_OP) {
|
|
|
|
image_quality_menu->entries[0].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else if (tinct_options & tinct_ERROR_DIFFUSE) {
|
|
|
|
image_quality_menu->entries[3].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else if (tinct_options & tinct_DITHER) {
|
|
|
|
image_quality_menu->entries[2].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
} else {
|
|
|
|
image_quality_menu->entries[1].menu_flags |= wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-08 21:28:56 +04:00
|
|
|
void ro_gui_menu_prepare_pageinfo(void)
|
2004-04-03 06:59:35 +04:00
|
|
|
{
|
2004-07-17 17:00:38 +04:00
|
|
|
struct content *c = current_gui->bw->current_content;
|
2004-06-27 02:31:34 +04:00
|
|
|
char icon_buf[20] = "file_xxx";
|
2005-01-02 01:05:21 +03:00
|
|
|
char enc_buf[40];
|
|
|
|
char enc_token[10] = "Encoding0";
|
2004-06-27 02:31:34 +04:00
|
|
|
const char *icon = icon_buf;
|
|
|
|
const char *title = "-";
|
|
|
|
const char *url = "-";
|
|
|
|
const char *enc = "-";
|
|
|
|
const char *mime = "-";
|
|
|
|
|
2004-07-07 04:31:57 +04:00
|
|
|
if (c->title != 0) title = c->title;
|
|
|
|
if (c->url != 0) url = c->url;
|
|
|
|
if (c->mime_type != 0) mime = c->mime_type;
|
2004-06-27 02:31:34 +04:00
|
|
|
|
|
|
|
sprintf(icon_buf, "file_%x", ro_content_filetype(c));
|
|
|
|
|
2004-07-08 21:28:56 +04:00
|
|
|
/* Ensure the correct icon exists
|
|
|
|
*/
|
|
|
|
if (xwimpspriteop_read_sprite_info(icon_buf, 0, 0, 0, 0)) {
|
|
|
|
sprintf(icon_buf, "file_xxx");
|
|
|
|
}
|
|
|
|
|
2005-01-02 01:05:21 +03:00
|
|
|
if (c->type == CONTENT_HTML) {
|
|
|
|
if (c->data.html.encoding) {
|
|
|
|
enc_token[8] = '0' + c->data.html.encoding_source;
|
|
|
|
snprintf(enc_buf, sizeof enc_buf, "%s (%s)",
|
|
|
|
c->data.html.encoding,
|
|
|
|
messages_get(enc_token));
|
|
|
|
enc = enc_buf;
|
|
|
|
} else {
|
|
|
|
enc = messages_get("EncodingUnk");
|
|
|
|
}
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_ICON, icon);
|
2004-04-03 06:59:35 +04:00
|
|
|
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_TITLE, title);
|
|
|
|
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);
|
|
|
|
}
|
2004-05-05 04:02:13 +04:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
|
2004-05-05 04:02:13 +04:00
|
|
|
void ro_gui_menu_objectinfo(wimp_message_menu_warning *warning)
|
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
char icon_buf[20] = "file_xxx";
|
|
|
|
const char *url = "-";
|
|
|
|
const char *target = "-";
|
|
|
|
const char *mime = "-";
|
2004-07-18 21:38:01 +04:00
|
|
|
os_error *error;
|
2004-06-27 02:31:34 +04:00
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
sprintf(icon_buf, "file_%.3x",
|
2004-07-18 21:38:01 +04:00
|
|
|
ro_content_filetype(gui_menu_object_box->object));
|
2004-12-09 13:30:44 +03:00
|
|
|
if (!ro_gui_wimp_sprite_exists(icon_buf))
|
|
|
|
sprintf(icon_buf, "file_xxx");
|
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
if (gui_menu_object_box->object->url)
|
|
|
|
url = gui_menu_object_box->object->url;
|
|
|
|
if (gui_menu_object_box->href)
|
|
|
|
target = gui_menu_object_box->href;
|
|
|
|
if (gui_menu_object_box->object->mime_type)
|
|
|
|
mime = gui_menu_object_box->object->mime_type;
|
2004-06-27 02:31:34 +04:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_ICON, icon_buf);
|
2004-05-05 04:02:13 +04:00
|
|
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_URL, url);
|
|
|
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_TARGET, target);
|
|
|
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_TYPE, mime);
|
|
|
|
|
2004-06-27 02:31:34 +04:00
|
|
|
error = xwimp_create_sub_menu((wimp_menu *) dialog_objinfo,
|
2004-05-05 04:02:13 +04:00
|
|
|
warning->pos.x, warning->pos.y);
|
|
|
|
if (error) {
|
2004-07-18 21:38:01 +04:00
|
|
|
LOG(("xwimp_create_sub_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
2004-05-07 23:14:54 +04:00
|
|
|
warn_user("MenuError", error->errmess);
|
2004-05-05 04:02:13 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-29 21:26:42 +04:00
|
|
|
void ro_gui_menu_object_reload(void)
|
|
|
|
{
|
2004-07-18 21:38:01 +04:00
|
|
|
gui_menu_object_box->object->fresh = false;
|
|
|
|
browser_window_reload(current_gui->bw, false);
|
2004-06-29 21:26:42 +04:00
|
|
|
}
|
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Display a menu of options for a form select control.
|
|
|
|
*
|
2004-10-05 03:54:42 +04:00
|
|
|
* \param bw browser window containing form control
|
2004-07-18 03:32:09 +04:00
|
|
|
* \param control form control of type GADGET_SELECT
|
|
|
|
*/
|
|
|
|
|
|
|
|
void gui_create_form_select_menu(struct browser_window *bw,
|
|
|
|
struct form_control *control)
|
|
|
|
{
|
|
|
|
unsigned int i = 0, j;
|
|
|
|
struct form_option *option;
|
|
|
|
wimp_pointer pointer;
|
|
|
|
os_error *error;
|
|
|
|
|
|
|
|
for (option = control->data.select.items; option; option = option->next)
|
|
|
|
i++;
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (gui_form_select_menu) {
|
|
|
|
for (j = 0; ; j++) {
|
|
|
|
free(gui_form_select_menu->entries[j].data.
|
|
|
|
indirected_text.text);
|
|
|
|
if (gui_form_select_menu->entries[j].menu_flags &
|
|
|
|
wimp_MENU_LAST)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
free(gui_form_select_menu);
|
|
|
|
gui_form_select_menu = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gui_form_select_menu = malloc(wimp_SIZEOF_MENU(i));
|
|
|
|
if (!gui_form_select_menu) {
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gui_form_select_menu->title_data.indirected_text.text =
|
|
|
|
messages_get("SelectMenu");
|
|
|
|
gui_form_select_menu->title_fg = wimp_COLOUR_BLACK;
|
|
|
|
gui_form_select_menu->title_bg = wimp_COLOUR_LIGHT_GREY;
|
|
|
|
gui_form_select_menu->work_fg = wimp_COLOUR_BLACK;
|
|
|
|
gui_form_select_menu->work_bg = wimp_COLOUR_WHITE;
|
|
|
|
gui_form_select_menu->width = 200;
|
|
|
|
gui_form_select_menu->height = wimp_MENU_ITEM_HEIGHT;
|
|
|
|
gui_form_select_menu->gap = wimp_MENU_ITEM_GAP;
|
|
|
|
|
|
|
|
for (i = 0, option = control->data.select.items; option;
|
|
|
|
i++, option = option->next) {
|
|
|
|
gui_form_select_menu->entries[i].menu_flags = 0;
|
|
|
|
if (option->selected)
|
|
|
|
gui_form_select_menu->entries[i].menu_flags =
|
|
|
|
wimp_MENU_TICKED;
|
|
|
|
gui_form_select_menu->entries[i].sub_menu = wimp_NO_SUB_MENU;
|
|
|
|
gui_form_select_menu->entries[i].icon_flags = wimp_ICON_TEXT |
|
|
|
|
wimp_ICON_INDIRECTED | wimp_ICON_FILLED |
|
|
|
|
(wimp_COLOUR_BLACK <<
|
|
|
|
wimp_ICON_FG_COLOUR_SHIFT) |
|
|
|
|
(wimp_COLOUR_WHITE <<
|
|
|
|
wimp_ICON_BG_COLOUR_SHIFT);
|
|
|
|
/* \todo can cnv_str_local_enc() fail? */
|
|
|
|
gui_form_select_menu->entries[i].data.indirected_text.text =
|
|
|
|
cnv_str_local_enc(option->text);
|
|
|
|
gui_form_select_menu->entries[i].data.indirected_text.
|
|
|
|
validation = "\0";
|
|
|
|
gui_form_select_menu->entries[i].data.indirected_text.size =
|
|
|
|
strlen(gui_form_select_menu->entries[i].
|
|
|
|
data.indirected_text.text) + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gui_form_select_menu->entries[0].menu_flags |=
|
|
|
|
wimp_MENU_TITLE_INDIRECTED;
|
|
|
|
gui_form_select_menu->entries[i - 1].menu_flags |= wimp_MENU_LAST;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
current_gui = bw->window;
|
|
|
|
gui_form_select_control = control;
|
|
|
|
ro_gui_create_menu(gui_form_select_menu,
|
2004-07-18 21:38:01 +04:00
|
|
|
pointer.pos.x, pointer.pos.y, bw->window);
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
2004-09-14 03:56:18 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create and display a menu listing all fonts present in the system.
|
|
|
|
*
|
|
|
|
* \param tick The name of the currently selected font
|
|
|
|
* \param w The dialog containing the clicked icon
|
|
|
|
* \param i The clicked icon.
|
|
|
|
*/
|
|
|
|
void ro_gui_display_font_menu(const char *tick, wimp_w w, wimp_i i)
|
|
|
|
{
|
|
|
|
int size1, size2;
|
|
|
|
os_error *error;
|
|
|
|
|
|
|
|
error = xfont_list_fonts(0, font_RETURN_FONT_MENU | font_GIVEN_TICK,
|
|
|
|
0, 0, 0, tick, 0, &size1, &size2);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xfont_list_fonts: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free previous menu */
|
|
|
|
if (font_menu)
|
|
|
|
free(font_menu);
|
|
|
|
if (font_menu_data)
|
|
|
|
free(font_menu_data);
|
|
|
|
|
|
|
|
font_menu = calloc(size1, sizeof(byte));
|
|
|
|
if (!font_menu) {
|
|
|
|
LOG(("malloc failed"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
font_menu_data = calloc(size2, sizeof(byte));
|
|
|
|
if (!font_menu_data) {
|
|
|
|
LOG(("malloc failed"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = xfont_list_fonts((byte*)font_menu,
|
|
|
|
font_RETURN_FONT_MENU | font_GIVEN_TICK,
|
|
|
|
size1, font_menu_data, size2, tick, 0, 0, 0);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xfont_list_fonts: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ro_gui_popup_menu(font_menu, w, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle a selection in the font menu
|
|
|
|
*
|
|
|
|
* \param selection The selection block
|
|
|
|
*/
|
|
|
|
void ro_gui_font_menu_selection(wimp_selection *selection)
|
|
|
|
{
|
|
|
|
int buf_size;
|
|
|
|
char *buf;
|
|
|
|
os_error *error;
|
|
|
|
|
|
|
|
error = xfont_decode_menu(0, (byte*)font_menu, (byte*)selection,
|
|
|
|
0, 0, 0, &buf_size);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xfont_decode_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf = calloc(buf_size, sizeof(char));
|
|
|
|
if (!buf) {
|
|
|
|
LOG(("malloc failed"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = xfont_decode_menu(0, (byte*)font_menu, (byte*)selection,
|
|
|
|
buf, buf_size, 0, 0);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xfont_decode_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ro_gui_dialog_font_menu_selection(buf);
|
|
|
|
|
|
|
|
free(buf);
|
|
|
|
}
|