mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-24 04:56:50 +03:00
[project @ 2004-07-16 16:33:44 by rjw]
Various fixes for the GUI. Persistant windows are closed when upon a change of content. Hotlist saves in the same format as !Browse. Neater login window. Support for interactive help from hotlist windows. svn path=/import/netsurf/; revision=1081
This commit is contained in:
parent
99d1c18252
commit
abaa8a9093
@ -280,3 +280,21 @@ HelpScaleView7:\Sautomatically choose a scale of 100%.
|
||||
HelpScaleView8:\Sautomatically choose a scale of 120%.
|
||||
HelpScaleView9:\Scancel changes.|MThe current scale will not be changed.
|
||||
HelpScaleView10:\Schange the view to the scale you have chosen.
|
||||
|
||||
HelpHotFolder:Use this \w to set the folder name.
|
||||
HelpHotEntry:Use this \w to set the entry details.
|
||||
HelpHotlist:Use this window to view and modify your hotlists.
|
||||
HelpHotlist0:\Sto expand this folder.
|
||||
HelpHotlist1:\Sto collapse this folder.
|
||||
HelpHotlist2:\Sto show the entry details.
|
||||
HelpHotlist3:\Sto hide the entry details.
|
||||
HelpHotlist4:\Sto select this folder.
|
||||
HelpHotlist5:\Sto select this entry.
|
||||
HelpHotlist6:Release the mouse buttons to complete your selection.
|
||||
HelpHotlist7:Release the mouse buttons to move the selection.
|
||||
|
||||
HelpHotToolbar0:\Tcreate button.|M\Screate a new folder.|M\Acreate a new entry.
|
||||
HelpHotToolbar1:\Tdelete button.|M\Sdelete the current selection.
|
||||
HelpHotToolbar2:\Tlaunch button.|M\Slaunch the current selection.
|
||||
HelpHotToolbar3:\Texpand folders button.|M\Sexpand all folders.|M\Acollapse all folders.|M
|
||||
HelpHotToolbar4:\Texpand entries button.|M\Sexpand all entries.|M\Acollapse all entries.|M
|
||||
|
Binary file not shown.
@ -280,3 +280,22 @@ HelpScaleView7:\Sautomatically choose a scale of 100%.
|
||||
HelpScaleView8:\Sautomatically choose a scale of 120%.
|
||||
HelpScaleView9:\Scancel changes.|MThe current scale will not be changed.
|
||||
HelpScaleView10:\Schange the view to the scale you have chosen.
|
||||
|
||||
|
||||
HelpHotFolder:Use this \w to set the folder name.
|
||||
HelpHotEntry:Use this \w to set the entry details.
|
||||
HelpHotlist:Use this window to view and modify your hotlists.
|
||||
HelpHotlist0:\Sto expand this folder.
|
||||
HelpHotlist1:\Sto collapse this folder.
|
||||
HelpHotlist2:\Sto show the entry details.
|
||||
HelpHotlist3:\Sto hide the entry details.
|
||||
HelpHotlist4:\Sto select this folder.
|
||||
HelpHotlist5:\Sto select this entry.
|
||||
HelpHotlist6:Release the mouse buttons to complete your selection.
|
||||
HelpHotlist7:Release the mouse buttons to move the selection.
|
||||
|
||||
HelpHotToolbar0:\Tcreate button.|M\Screate a new folder.|M\Acreate a new entry.
|
||||
HelpHotToolbar1:\Tdelete button.|M\Sdelete the current selection.
|
||||
HelpHotToolbar2:\Tlaunch button.|M\Slaunch the current selection.
|
||||
HelpHotToolbar3:\Texpand folders button.|M\Sexpand all folders.|M\Acollapse all folders.|M
|
||||
HelpHotToolbar4:\Texpand entries button.|M\Sexpand all entries.|M\Acollapse all entries.|M
|
||||
|
Binary file not shown.
@ -220,6 +220,7 @@ void browser_window_callback(content_msg msg, struct content *c,
|
||||
bw->current_content = c;
|
||||
bw->loading_content = 0;
|
||||
bw->caret_callback = 0;
|
||||
gui_window_new_content(bw->window);
|
||||
gui_window_set_url(bw->window, c->url);
|
||||
browser_window_update(bw, true);
|
||||
browser_window_set_status(bw, c->status_message);
|
||||
|
@ -65,4 +65,6 @@ void gui_window_place_caret(gui_window *g, int x, int y, int height);
|
||||
|
||||
void gui_launch_url(const char *url);
|
||||
|
||||
void gui_window_new_content(gui_window *g);
|
||||
|
||||
#endif
|
||||
|
@ -52,7 +52,7 @@ void gui_401login_open(struct browser_window *bw, struct content *c, char *realm
|
||||
assert(host);
|
||||
bwin = bw;
|
||||
|
||||
ro_gui_401login_open(host, realm, murl);
|
||||
ro_gui_401login_open(bw->window->window, host, realm, murl);
|
||||
|
||||
xfree(host);
|
||||
}
|
||||
@ -62,7 +62,7 @@ void gui_401login_open(struct browser_window *bw, struct content *c, char *realm
|
||||
* Open a 401 login window.
|
||||
*/
|
||||
|
||||
void ro_gui_401login_open(char *host, char* realm, char *fetchurl)
|
||||
void ro_gui_401login_open(wimp_w parent, char *host, char* realm, char *fetchurl)
|
||||
{
|
||||
url = xstrdup(fetchurl);
|
||||
uname = xcalloc(1, 256);
|
||||
@ -89,9 +89,7 @@ void ro_gui_401login_open(char *host, char* realm, char *fetchurl)
|
||||
|
||||
/* create and open the window */
|
||||
dialog_401li = wimp_create_window(dialog_401_template);
|
||||
ro_gui_dialog_open(dialog_401li);
|
||||
wimp_set_caret_position(dialog_401li, ICON_401LOGIN_USERNAME,
|
||||
-1, -1, -1, 0);
|
||||
ro_gui_dialog_open_persistant(parent, dialog_401li, false);
|
||||
}
|
||||
|
||||
bool ro_gui_401login_keypress(wimp_key *key)
|
||||
@ -102,9 +100,6 @@ bool ro_gui_401login_keypress(wimp_key *key)
|
||||
ro_gui_dialog_close(dialog_401li);
|
||||
browser_window_go(bwin, url);
|
||||
return true;
|
||||
case wimp_KEY_ESCAPE:
|
||||
ro_gui_dialog_close(dialog_401li);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -224,18 +224,19 @@ void ro_gui_dialog_open(wimp_w w)
|
||||
/**
|
||||
* Open a persistant dialog box relative to the pointer.
|
||||
*
|
||||
* \param parent the owning window (NULL for no owner)
|
||||
* \param w the dialog window
|
||||
* \param parent the owning window (NULL for no owner)
|
||||
* \param w the dialog window
|
||||
* \param pointer open the window at the pointer (centre of the parent otherwise)
|
||||
*/
|
||||
void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w) {
|
||||
void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w, bool pointer) {
|
||||
int dx, dy, i;
|
||||
wimp_pointer pointer;
|
||||
wimp_pointer ptr;
|
||||
wimp_window_state open;
|
||||
os_error *error;
|
||||
|
||||
/* Get the pointer position
|
||||
*/
|
||||
error = xwimp_get_pointer_info(&pointer);
|
||||
error = xwimp_get_pointer_info(&ptr);
|
||||
if (error) {
|
||||
LOG(("xwimp_get_pointer_info: 0x%x: %s\n",
|
||||
error->errnum, error->errmess));
|
||||
@ -245,16 +246,20 @@ void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w) {
|
||||
|
||||
/* Move and open
|
||||
*/
|
||||
open.w = w;
|
||||
wimp_get_window_state(&open);
|
||||
dx = (open.visible.x1 - open.visible.x0);
|
||||
dy = (open.visible.y1 - open.visible.y0);
|
||||
open.visible.x0 = pointer.pos.x - 64;
|
||||
open.visible.x1 = pointer.pos.x - 64 + dx;
|
||||
open.visible.y0 = pointer.pos.y - dy;
|
||||
open.visible.y1 = pointer.pos.y;
|
||||
open.next = wimp_TOP;
|
||||
wimp_open_window((wimp_open *) &open);
|
||||
if (pointer) {
|
||||
open.w = w;
|
||||
wimp_get_window_state(&open);
|
||||
dx = (open.visible.x1 - open.visible.x0);
|
||||
dy = (open.visible.y1 - open.visible.y0);
|
||||
open.visible.x0 = ptr.pos.x - 64;
|
||||
open.visible.x1 = ptr.pos.x - 64 + dx;
|
||||
open.visible.y0 = ptr.pos.y - dy;
|
||||
open.visible.y1 = ptr.pos.y;
|
||||
open.next = wimp_TOP;
|
||||
wimp_open_window((wimp_open *) &open);
|
||||
} else {
|
||||
ro_gui_open_window_centre(parent, w);
|
||||
}
|
||||
|
||||
/* Set the caret position
|
||||
*/
|
||||
|
10
riscos/gui.c
10
riscos/gui.c
@ -1354,6 +1354,16 @@ void gui_launch_url(const char *url)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when the gui_window has new content
|
||||
*
|
||||
* \g the gui_window that has new content
|
||||
*/
|
||||
void gui_window_new_content(gui_window *g) {
|
||||
ro_gui_dialog_close_persistant(g->window);
|
||||
}
|
||||
|
||||
|
||||
static char warn_buffer[300];
|
||||
|
||||
/**
|
||||
|
@ -125,7 +125,7 @@ void ro_gui_dialog_init(void);
|
||||
wimp_w ro_gui_dialog_create(const char *template_name);
|
||||
wimp_window * ro_gui_dialog_load_template(const char *template_name);
|
||||
void ro_gui_dialog_open(wimp_w w);
|
||||
void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w);
|
||||
void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w, bool pointer);
|
||||
void ro_gui_dialog_close_persistant(wimp_w parent);
|
||||
void ro_gui_dialog_click(wimp_pointer *pointer);
|
||||
void ro_gui_save_options(void);
|
||||
@ -153,7 +153,7 @@ void ro_gui_selection_drag_end(wimp_dragged *drag);
|
||||
/* in 401login.c */
|
||||
#ifdef WITH_AUTH
|
||||
void ro_gui_401login_init(void);
|
||||
void ro_gui_401login_open(char* host, char * realm, char* fetchurl);
|
||||
void ro_gui_401login_open(wimp_w parent, char* host, char * realm, char* fetchurl);
|
||||
void ro_gui_401login_click(wimp_pointer *pointer);
|
||||
bool ro_gui_401login_keypress(wimp_key *key);
|
||||
#endif
|
||||
@ -208,10 +208,11 @@ void ro_gui_hotlist_save_as(const char *file);
|
||||
void ro_gui_hotlist_prepare_folder_dialog(bool selected);
|
||||
void ro_gui_hotlist_prepare_entry_dialog(bool selected);
|
||||
void ro_gui_hotlist_dialog_click(wimp_pointer *pointer);
|
||||
int ro_gui_hotlist_help(int x, int y);
|
||||
|
||||
/* in save.c */
|
||||
void ro_gui_save_open(gui_save_type save_type, struct content *c,
|
||||
bool sub_menu, int x, int y, wimp_w parent);
|
||||
bool sub_menu, int x, int y, wimp_w parent, bool keypress);
|
||||
void ro_gui_save_click(wimp_pointer *pointer);
|
||||
void ro_gui_drag_icon(wimp_pointer *pointer);
|
||||
void ro_gui_save_drag_end(wimp_dragged *drag);
|
||||
|
@ -28,22 +28,31 @@
|
||||
HelpIconbar Iconbar (no icon suffix is used)
|
||||
|
||||
HelpAppInfo Application info window
|
||||
HelpBrowser Browser window
|
||||
HelpHistory History window
|
||||
HelpBrowser Browser window [*]
|
||||
HelpHistory History window [*]
|
||||
HelpObjInfo Object info window
|
||||
HelpPageInfo Page info window
|
||||
HelpSaveAs Save as window
|
||||
HelpScaleView Scale view window
|
||||
HelpStatus Status window
|
||||
HelpToolbar Toolbar window
|
||||
HelpHotlist Hotlist window [*]
|
||||
HelpHotToolbar Hotlist window toolbar
|
||||
HelpHotEntry Hotlist entry window
|
||||
HelpHotFolder Hotlist entry window
|
||||
|
||||
HelpIconMenu Iconbar menu
|
||||
HelpBrowserMenu Browser window menu
|
||||
HelpHotlistMenu Hotlist window menu
|
||||
|
||||
The prefixes are followed by either the icon number (eg 'HelpToolbar7'), or a series
|
||||
of numbers representing the menu structure (eg 'HelpBrowserMenu3-1-2').
|
||||
If '<key><identifier>' is not available, then simply '<key>' is then used. For example
|
||||
if 'HelpToolbar7' is not available then 'HelpToolbar' is then tried.
|
||||
|
||||
For items marked with an asterisk [*] a call must be made to determine the required
|
||||
help text as the window does not contain any icons. An example of this is the hotlist
|
||||
window where ro_gui_hotlist_help() is called.
|
||||
*/
|
||||
|
||||
static void ro_gui_interactive_help_broadcast(wimp_message *message, char *token);
|
||||
@ -98,6 +107,15 @@ void ro_gui_interactive_help_request(wimp_message *message) {
|
||||
sprintf(message_token, "HelpSaveAs%i", (int)icon);
|
||||
} else if (window == dialog_zoom) {
|
||||
sprintf(message_token, "HelpScaleView%i", (int)icon);
|
||||
} else if (window == dialog_folder) {
|
||||
sprintf(message_token, "HelpHotFolder%i", (int)icon);
|
||||
} else if (window == dialog_entry) {
|
||||
sprintf(message_token, "HelpHotEntry%i", (int)icon);
|
||||
} else if (window == hotlist_window) {
|
||||
sprintf(message_token, "HelpHotlist%i",
|
||||
ro_gui_hotlist_help(message_data->pos.x, message_data->pos.y));
|
||||
} else if ((hotlist_toolbar) && (window == hotlist_toolbar->toolbar_handle)) {
|
||||
sprintf(message_token, "HelpHotToolbar%i", (int)icon);
|
||||
} else {
|
||||
|
||||
/* Check if we have a browser window, toolbar window or status window
|
||||
@ -142,6 +160,8 @@ void ro_gui_interactive_help_request(wimp_message *message) {
|
||||
sprintf(message_token, "HelpIconMenu");
|
||||
} else if (current_menu == browser_menu) {
|
||||
sprintf(message_token, "HelpBrowserMenu");
|
||||
} else if (current_menu == hotlist_menu) {
|
||||
sprintf(message_token, "HelpHotlistMenu");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -240,7 +260,7 @@ int ro_gui_interactive_help_available() {
|
||||
/* We can't just use strcmp due to string termination issues.
|
||||
*/
|
||||
if (strncmp(task.name, "Help", 4) == 0) {
|
||||
if (task.name[4] < 32) return true;
|
||||
if (task.name[4] < 32) return true;
|
||||
}
|
||||
} while (context >= 0);
|
||||
|
||||
|
@ -184,6 +184,7 @@ static char *sprite[6];
|
||||
|
||||
/* The drag buttons
|
||||
*/
|
||||
bool dragging;
|
||||
wimp_mouse_state drag_buttons;
|
||||
|
||||
/* Whether the current selection was from a menu click
|
||||
@ -402,6 +403,7 @@ void ro_gui_hotlist_show(void) {
|
||||
|
||||
bool ro_gui_hotlist_load(void) {
|
||||
htmlDocPtr doc;
|
||||
const char *encoding;
|
||||
fileswitch_object_type obj_type = 0;
|
||||
struct hotlist_entry *netsurf;
|
||||
struct hotlist_entry *entry = &root;
|
||||
@ -414,7 +416,8 @@ bool ro_gui_hotlist_load(void) {
|
||||
if (obj_type != 0) {
|
||||
/* Read our file
|
||||
*/
|
||||
doc = htmlParseFile("<Choices$Write>.WWW.NetSurf.Hotlist", "UTF-8");
|
||||
encoding = xmlGetCharEncodingName(XML_CHAR_ENCODING_8859_1);
|
||||
doc = htmlParseFile("<Choices$Write>.WWW.NetSurf.Hotlist", encoding);
|
||||
if ((!doc) || (!(doc->children))) {
|
||||
xmlFreeDoc(doc);
|
||||
warn_user("HotlistLoadError", 0);
|
||||
@ -570,7 +573,8 @@ void ro_gui_hotlist_save_as(const char *file) {
|
||||
|
||||
/* HTML header
|
||||
*/
|
||||
fprintf(fp, "<html>\n<head>\n<title>Hotlist</title>\n</head>\n<body>\n");
|
||||
fprintf(fp, "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");
|
||||
fprintf(fp, "<title>Hotlist</title>\n</head>\n<body>\n");
|
||||
|
||||
/* Start our recursive save
|
||||
*/
|
||||
@ -603,22 +607,15 @@ bool ro_gui_hotlist_save_entry(FILE *fp, struct hotlist_entry *entry) {
|
||||
while (entry) {
|
||||
/* Save this entry
|
||||
*/
|
||||
if (entry->url) {
|
||||
fprintf(fp, "<li><a href=\"%s\">%s</a>\n", entry->url, entry->title);
|
||||
if (entry->children >= 0) {
|
||||
fprintf(fp, "<h4>%s</h4>\n", entry->title);
|
||||
if (entry->child_entry) ro_gui_hotlist_save_entry(fp, entry->child_entry);
|
||||
} else {
|
||||
fprintf(fp, "<li>%s\n", entry->title);
|
||||
}
|
||||
if (entry->url) {
|
||||
fprintf(fp, "<!-- Type:%i -->\n", entry->filetype);
|
||||
}
|
||||
if (entry->add_date != -1) fprintf(fp, "<!-- Added:%i -->\n", (int)entry->add_date);
|
||||
if (entry->last_date != -1) fprintf(fp, "<!-- LastVisit:%i -->\n", (int)entry->last_date);
|
||||
if (entry->visits != 0) fprintf(fp, "<!-- Visits:%i -->\n", entry->visits);
|
||||
|
||||
/* Continue onwards
|
||||
*/
|
||||
if (entry->child_entry) {
|
||||
ro_gui_hotlist_save_entry(fp, entry->child_entry);
|
||||
fprintf(fp, "<li><a href=\"%s\">%s</a>\n", entry->url, entry->title);
|
||||
if (entry->filetype != 0xfaf) fprintf(fp, "<!-- Type:%i -->\n", entry->filetype);
|
||||
if (entry->add_date != -1) fprintf(fp, "<!--Added:%i-->\n", (int)entry->add_date);
|
||||
if (entry->last_date != -1) fprintf(fp, "<!--LastVisit:%i-->\n", (int)entry->last_date);
|
||||
if (entry->visits != 0) fprintf(fp, "<!--Visits:%i-->\n", entry->visits);
|
||||
}
|
||||
entry = entry->next_entry;
|
||||
}
|
||||
@ -1435,6 +1432,7 @@ void ro_gui_hotlist_click(wimp_pointer *pointer) {
|
||||
dragasprite_BOUND_POINTER |
|
||||
dragasprite_DROP_SHADOW,
|
||||
(osspriteop_area *) 1, drag_name, &box, 0);
|
||||
dragging = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1497,6 +1495,7 @@ void ro_gui_hotlist_click(wimp_pointer *pointer) {
|
||||
drag.bbox.y1 = state.visible.y1;
|
||||
if (hotlist_toolbar) drag.bbox.y1 -= hotlist_toolbar->height;
|
||||
xwimp_drag_box(&drag);
|
||||
dragging = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1858,6 +1857,10 @@ void ro_gui_hotlist_selection_drag_end(wimp_dragged *drag) {
|
||||
wimp_window_state state;
|
||||
int x0, y0, x1, y1;
|
||||
int toolbar_height = 0;
|
||||
|
||||
/* Reset our dragging state
|
||||
*/
|
||||
dragging = false;
|
||||
|
||||
/* Get the toolbar height
|
||||
*/
|
||||
@ -1911,12 +1914,16 @@ void ro_gui_hotlist_move_drag_end(wimp_dragged *drag) {
|
||||
struct hotlist_entry *entry;
|
||||
int x, y, x0, y0, x1, y1;
|
||||
bool before = false;
|
||||
|
||||
/* Reset our dragging state
|
||||
*/
|
||||
dragging = false;
|
||||
|
||||
|
||||
/* Check we dropped to our window
|
||||
*/
|
||||
xwimp_get_pointer_info(&pointer);
|
||||
if (pointer.w != hotlist_window) return;
|
||||
|
||||
|
||||
/* Get the toolbar height
|
||||
*/
|
||||
if (hotlist_toolbar) toolbar_height = hotlist_toolbar->height * 2;
|
||||
@ -2301,8 +2308,8 @@ void ro_gui_hotlist_dialog_click(wimp_pointer *pointer) {
|
||||
/* Close if we should
|
||||
*/
|
||||
if (pointer->buttons == wimp_CLICK_SELECT) {
|
||||
ro_gui_dialog_close(pointer->w);
|
||||
xwimp_create_menu((wimp_menu *)-1, 0, 0);
|
||||
ro_gui_dialog_close(pointer->w);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2314,3 +2321,48 @@ void ro_gui_hotlist_dialog_click(wimp_pointer *pointer) {
|
||||
ro_gui_hotlist_prepare_entry_dialog(dialog_entry_add);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ro_gui_hotlist_help(int x, int y) {
|
||||
struct hotlist_entry *entry;
|
||||
wimp_window_state state;
|
||||
int toolbar_height = 0;
|
||||
int x_offset, y_offset;
|
||||
|
||||
/* Return the dragging codes
|
||||
*/
|
||||
if (dragging) {
|
||||
if (gui_current_drag_type == GUI_DRAG_HOTLIST_SELECT) return 6;
|
||||
if (gui_current_drag_type == GUI_DRAG_HOTLIST_MOVE) return 7;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get the toolbar height
|
||||
*/
|
||||
if (hotlist_toolbar) toolbar_height = hotlist_toolbar->height * 2;
|
||||
|
||||
/* Get the window state to make everything relative
|
||||
*/
|
||||
state.w = hotlist_window;
|
||||
wimp_get_window_state(&state);
|
||||
|
||||
/* Create the relative positions
|
||||
*/
|
||||
x = x - state.visible.x0 - state.xscroll;
|
||||
y = y - state.visible.y1 - state.yscroll + toolbar_height;
|
||||
|
||||
/* Get the current entry
|
||||
*/
|
||||
entry = ro_gui_hotlist_find_entry(x, y, root.child_entry);
|
||||
if (entry == NULL) return -1;
|
||||
|
||||
/* Return the relevant code
|
||||
*/
|
||||
x_offset = x - entry->x0;
|
||||
y_offset = y - (entry->y0 + entry->height);
|
||||
if ((x_offset < HOTLIST_LEAF_INSET) && (y_offset > -HOTLIST_LINE_HEIGHT)) {
|
||||
if (entry->children == 0) return -1;
|
||||
return (((entry->children == -1) ? 2 : 0) + ((entry->expanded) ? 1 : 0));
|
||||
}
|
||||
return ((entry->children == -1) ? 5 : 4);
|
||||
}
|
||||
|
@ -853,12 +853,12 @@ void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning)
|
||||
|
||||
case 1: /* Save */
|
||||
ro_gui_save_open(GUI_SAVE_SOURCE, c, true,
|
||||
warning->pos.x, warning->pos.y, 0);
|
||||
warning->pos.x, warning->pos.y, 0, false);
|
||||
break;
|
||||
|
||||
case 2: /* Save complete */
|
||||
ro_gui_save_open(GUI_SAVE_COMPLETE, c, true,
|
||||
warning->pos.x, warning->pos.y, 0);
|
||||
warning->pos.x, warning->pos.y, 0, false);
|
||||
break;
|
||||
|
||||
case 3: /* Export as -> */
|
||||
@ -866,13 +866,13 @@ void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning)
|
||||
case 0: /* Draw */
|
||||
ro_gui_save_open(GUI_SAVE_DRAW, c, true,
|
||||
warning->pos.x, warning->pos.y,
|
||||
0);
|
||||
0, false);
|
||||
break;
|
||||
|
||||
case 1: /* Text */
|
||||
ro_gui_save_open(GUI_SAVE_TEXT, c, true,
|
||||
warning->pos.x, warning->pos.y,
|
||||
0);
|
||||
0, false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -882,19 +882,19 @@ void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning)
|
||||
case 0: /* URI */
|
||||
ro_gui_save_open(GUI_SAVE_LINK_URI, c, true,
|
||||
warning->pos.x, warning->pos.y,
|
||||
0);
|
||||
0, false);
|
||||
break;
|
||||
|
||||
case 1: /* URL */
|
||||
ro_gui_save_open(GUI_SAVE_LINK_URL, c, true,
|
||||
warning->pos.x, warning->pos.y,
|
||||
0);
|
||||
0, false);
|
||||
break;
|
||||
|
||||
case 2: /* Text */
|
||||
ro_gui_save_open(GUI_SAVE_LINK_TEXT, c, true,
|
||||
warning->pos.x, warning->pos.y,
|
||||
0);
|
||||
0, false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -917,7 +917,7 @@ void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning)
|
||||
case 1: /* Save */
|
||||
ro_gui_save_open(GUI_SAVE_OBJECT_ORIG, box->object,
|
||||
true,
|
||||
warning->pos.x, warning->pos.y, 0);
|
||||
warning->pos.x, warning->pos.y, 0, false);
|
||||
break;
|
||||
|
||||
case 2: /* Export */
|
||||
@ -926,7 +926,7 @@ void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning)
|
||||
ro_gui_save_open(GUI_SAVE_OBJECT_NATIVE,
|
||||
box->object, true,
|
||||
warning->pos.x, warning->pos.y,
|
||||
0);
|
||||
0, false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -937,21 +937,21 @@ void ro_gui_menu_browser_warning(wimp_message_menu_warning *warning)
|
||||
ro_gui_save_open(GUI_SAVE_LINK_URI,
|
||||
box->object, true,
|
||||
warning->pos.x, warning->pos.y,
|
||||
0);
|
||||
0, false);
|
||||
break;
|
||||
|
||||
case 1: /* URL */
|
||||
ro_gui_save_open(GUI_SAVE_LINK_URL,
|
||||
box->object, true,
|
||||
warning->pos.x, warning->pos.y,
|
||||
0);
|
||||
0, false);
|
||||
break;
|
||||
|
||||
case 2: /* Text */
|
||||
ro_gui_save_open(GUI_SAVE_LINK_TEXT,
|
||||
box->object, true,
|
||||
warning->pos.x, warning->pos.y,
|
||||
0);
|
||||
0, false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -1040,7 +1040,7 @@ void ro_gui_menu_hotlist_warning(wimp_message_menu_warning *warning)
|
||||
break;
|
||||
case 2: /* Export-> */
|
||||
ro_gui_save_open(GUI_SAVE_HOTLIST_EXPORT_HTML, 0, true,
|
||||
warning->pos.x, warning->pos.y, 0);
|
||||
warning->pos.x, warning->pos.y, 0, false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -77,7 +77,7 @@ struct gui_save_table_entry gui_save_table[] = {
|
||||
*/
|
||||
|
||||
void ro_gui_save_open(gui_save_type save_type, struct content *c,
|
||||
bool sub_menu, int x, int y, wimp_w parent)
|
||||
bool sub_menu, int x, int y, wimp_w parent, bool keypress)
|
||||
{
|
||||
char icon_buf[20];
|
||||
const char *icon = icon_buf;
|
||||
@ -117,7 +117,7 @@ void ro_gui_save_open(gui_save_type save_type, struct content *c,
|
||||
warn_user("MenuError", error->errmess);
|
||||
}
|
||||
} else {
|
||||
ro_gui_dialog_open_persistant(parent, dialog_saveas);
|
||||
ro_gui_dialog_open_persistant(parent, dialog_saveas, !keypress);
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,8 +134,8 @@ void ro_gui_save_click(wimp_pointer *pointer)
|
||||
break;
|
||||
case ICON_SAVE_CANCEL:
|
||||
if (pointer->buttons == wimp_CLICK_SELECT) {
|
||||
ro_gui_dialog_close(pointer->w);
|
||||
xwimp_create_menu((wimp_menu *)-1, 0, 0);
|
||||
ro_gui_dialog_close(pointer->w);
|
||||
} else if (pointer->buttons == wimp_CLICK_ADJUST) {
|
||||
/* ro_gui_menu_prepare_save(gui_save_content); */
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "oslib/wimpreadsysinfo.h"
|
||||
#include "oslib/wimpspriteop.h"
|
||||
#include "netsurf/desktop/gui.h"
|
||||
#include "netsurf/riscos/gui.h"
|
||||
#include "netsurf/riscos/wimp.h"
|
||||
#include "netsurf/utils/log.h"
|
||||
#include "netsurf/utils/utils.h"
|
||||
@ -317,6 +318,62 @@ void ro_gui_set_caret_first(wimp_w w) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Opens a window at the centre of either another window or the screen
|
||||
*
|
||||
* /param parent the parent window (NULL for centre of screen)
|
||||
* /param child the child window
|
||||
*/
|
||||
void ro_gui_open_window_centre(wimp_w parent, wimp_w child) {
|
||||
os_error *error;
|
||||
wimp_window_state state;
|
||||
int mid_x, mid_y;
|
||||
int dimension, scroll_width;
|
||||
|
||||
/* Get the parent window state
|
||||
*/
|
||||
if (parent) {
|
||||
state.w = parent;
|
||||
error = xwimp_get_window_state(&state);
|
||||
if (error) {
|
||||
warn_user("WimpError", error->errmess);
|
||||
return;
|
||||
}
|
||||
scroll_width = ro_get_vscroll_width(parent);
|
||||
|
||||
/* Get the centre of the parent
|
||||
*/
|
||||
mid_x = (state.visible.x0 + state.visible.x1 + scroll_width) / 2;
|
||||
mid_y = (state.visible.y0 + state.visible.y1) / 2;
|
||||
} else {
|
||||
ro_gui_screen_size(&mid_x, &mid_y);
|
||||
mid_x /= 2;
|
||||
mid_y /= 2;
|
||||
}
|
||||
|
||||
/* Get the child window state
|
||||
*/
|
||||
state.w = child;
|
||||
error = xwimp_get_window_state(&state);
|
||||
if (error) {
|
||||
warn_user("WimpError", error->errmess);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Move to the centre of the parent at the top of the stack
|
||||
*/
|
||||
dimension = state.visible.x1 - state.visible.x0;
|
||||
scroll_width = ro_get_vscroll_width(hotlist_window);
|
||||
state.visible.x0 = mid_x - (dimension + scroll_width) / 2;
|
||||
state.visible.x1 = state.visible.x0 + dimension;
|
||||
dimension = state.visible.y1 - state.visible.y0;
|
||||
state.visible.y0 = mid_y - dimension / 2;
|
||||
state.visible.y1 = state.visible.y0 + dimension;
|
||||
state.next = wimp_TOP;
|
||||
wimp_open_window((wimp_open *) &state);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load a sprite file into memory.
|
||||
*
|
||||
|
@ -41,6 +41,7 @@ int ro_gui_get_icon_selected_state(wimp_w w, wimp_i i);
|
||||
#define ro_gui_set_icon_shaded_state(w, i, state) xwimp_set_icon_state(w, i, (state ? wimp_ICON_SHADED : 0), wimp_ICON_SHADED)
|
||||
void ro_gui_set_window_title(wimp_w w, const char *title);
|
||||
void ro_gui_set_caret_first(wimp_w w);
|
||||
void ro_gui_open_window_centre(wimp_w parent, wimp_w child);
|
||||
|
||||
osspriteop_area *ro_gui_load_sprite_file(const char *pathname);
|
||||
bool ro_gui_wimp_sprite_exists(const char *sprite);
|
||||
|
@ -750,7 +750,7 @@ void ro_gui_toolbar_click(gui_window* g, wimp_pointer* pointer) {
|
||||
current_gui = g;
|
||||
ro_gui_save_open(GUI_SAVE_SOURCE,
|
||||
g->data.browser.bw->current_content,
|
||||
false, 0, 0, g->window);
|
||||
false, 0, 0, g->window, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -950,7 +950,7 @@ bool ro_gui_window_keypress(gui_window *g, int key, bool toolbar)
|
||||
case wimp_KEY_CONTROL + wimp_KEY_F1:
|
||||
current_gui = g;
|
||||
ro_gui_menu_prepare_pageinfo();
|
||||
ro_gui_dialog_open_persistant(g->window, dialog_pageinfo);
|
||||
ro_gui_dialog_open_persistant(g->window, dialog_pageinfo, false);
|
||||
return true;
|
||||
case wimp_KEY_F1: /* Help. */
|
||||
ro_gui_open_help_page("docs");
|
||||
@ -998,25 +998,25 @@ bool ro_gui_window_keypress(gui_window *g, int key, bool toolbar)
|
||||
case wimp_KEY_F3:
|
||||
current_gui = g;
|
||||
ro_gui_save_open(GUI_SAVE_SOURCE, content,
|
||||
false, 0, 0, g->window);
|
||||
false, 0, 0, g->window, true);
|
||||
return true;
|
||||
|
||||
case wimp_KEY_CONTROL + wimp_KEY_F3:
|
||||
current_gui = g;
|
||||
ro_gui_save_open(GUI_SAVE_TEXT, content,
|
||||
false, 0, 0, g->window);
|
||||
false, 0, 0, g->window, true);
|
||||
return true;
|
||||
|
||||
case wimp_KEY_SHIFT + wimp_KEY_F3:
|
||||
current_gui = g;
|
||||
ro_gui_save_open(GUI_SAVE_COMPLETE, content,
|
||||
false, 0, 0, g->window);
|
||||
false, 0, 0, g->window, true);
|
||||
return true;
|
||||
|
||||
case wimp_KEY_CONTROL + wimp_KEY_SHIFT + wimp_KEY_F3:
|
||||
current_gui = g;
|
||||
ro_gui_save_open(GUI_SAVE_DRAW, content,
|
||||
false, 0, 0, g->window);
|
||||
false, 0, 0, g->window, true);
|
||||
return true;
|
||||
|
||||
case wimp_KEY_RETURN:
|
||||
|
Loading…
Reference in New Issue
Block a user