mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-14 05:24:16 +03:00
[project @ 2004-06-27 14:41:14 by rjw]
Improved window positioning svn path=/import/netsurf/; revision=1018
This commit is contained in:
parent
afceb17b80
commit
50e0ebf3fa
@ -17,6 +17,7 @@ Draw:Draw
|
||||
Text:Text ^F3
|
||||
SaveURL:Save location
|
||||
Print:Print...
|
||||
NewWindow:New window
|
||||
ViewSrc:View source... F8
|
||||
Object:Object
|
||||
ObjInfo:Info
|
||||
@ -52,6 +53,7 @@ ToolStatus:Status bar
|
||||
OptDefault:Set as default
|
||||
Window:Window
|
||||
WindowSave:Set as default position
|
||||
WindowStagr:Stagger window position
|
||||
WindowReset:Reset default position
|
||||
Help:Help
|
||||
HelpContent:Contents F1
|
||||
@ -173,7 +175,7 @@ HelpBrowserMenu0-4-0:\Rsave the current address in Acorn URI format.
|
||||
HelpBrowserMenu0-4-1:\Rsave the current address in Ant URL format.
|
||||
HelpBrowserMenu0-4-2:\Rsave the current address as plain text.
|
||||
#HelpBrowserMenu0-5:\Sopen the print dialogue box.
|
||||
HelpBrowserMenu0-6:\Sview the source code of the current page in a text editor.
|
||||
HelpBrowserMenu0-7:\Sview the source code of the current page in a text editor.
|
||||
HelpBrowserMenu1:\Rsee the options relating to the current item.
|
||||
HelpBrowserMenu1-0:\Rsee information about the current item.
|
||||
HelpBrowserMenu1-1:\Rsave the current item.
|
||||
@ -203,7 +205,7 @@ HelpBrowserMenu3-2-2:\Stoggle the display of the throbber.|MURL bar uses the rem
|
||||
HelpBrowserMenu3-2-3:\Stoggle the display of the status bar.|MHorizontal scroll bar uses the remaining width.
|
||||
HelpBrowserMenu3-3:\Rcontrol the default window positioning.
|
||||
HelpBrowserMenu3-3-0:\Sto make the current window position the default.
|
||||
HelpBrowserMenu3-3-1:\Sto return to the default window positioning.
|
||||
HelpBrowserMenu3-3-2:\Sto return to the default window positioning.
|
||||
HelpBrowserMenu3-4:\Smake your local display options the default options for NetSurf.
|
||||
HelpBrowserMenu4:\Rsee the help resources available.
|
||||
HelpBrowserMenu4-0:\Sopen the documentation contents page in a new \w.
|
||||
|
@ -17,6 +17,7 @@ Draw:Draw
|
||||
Text:Texte ^F3
|
||||
SaveURL:Sauver le lieu
|
||||
Print:Imprimer...
|
||||
NewWindow:New window
|
||||
ViewSrc:Voir le source... F8
|
||||
Object:Objet
|
||||
ObjInfo:Info
|
||||
@ -52,6 +53,7 @@ ToolStatus:Barre d'
|
||||
OptDefault:Définir par défaut
|
||||
Window:Fenêtre
|
||||
WindowSave:Définir comme position par défaut
|
||||
WindowStagr:Stagger window position
|
||||
WindowReset:RAZ de la position par défaut
|
||||
Help:Aide
|
||||
HelpContent:Contenus F1
|
||||
@ -171,7 +173,7 @@ HelpBrowserMenu0-4-0:\Rsave the current address in Acorn URI format.
|
||||
HelpBrowserMenu0-4-1:\Rsave the current address in Ant URL format.
|
||||
HelpBrowserMenu0-4-2:\Rsave the current address as plain text.
|
||||
#HelpBrowserMenu0-5:\Sopen the print dialogue box.
|
||||
HelpBrowserMenu0-6:\Sview the source code of the current page in a text editor.
|
||||
HelpBrowserMenu0-7:\Sview the source code of the current page in a text editor.
|
||||
HelpBrowserMenu1:\Rsee the options relating to the current item.
|
||||
HelpBrowserMenu1-0:\Rsee information about the current item.
|
||||
HelpBrowserMenu1-1:\Rsave the current item.
|
||||
@ -201,7 +203,7 @@ HelpBrowserMenu3-2-2:\Stoggle the display of the throbber.|MURL bar uses the rem
|
||||
HelpBrowserMenu3-2-3:\Stoggle the display of the status bar.|MHorizontal scroll bar uses the remaining width.
|
||||
HelpBrowserMenu3-3:\Rcontrol the default window positioning.
|
||||
HelpBrowserMenu3-3-0:\Sto make the current window position the default.
|
||||
HelpBrowserMenu3-3-1:\Sto return to the default window positioning.
|
||||
HelpBrowserMenu3-3-2:\Sto return to the default window positioning.
|
||||
HelpBrowserMenu3-4:\Smake your local display options the default options for NetSurf.
|
||||
HelpBrowserMenu4:\Rsee the help resources available.
|
||||
HelpBrowserMenu4-0:\Sopen the documentation contents page in a new \w.
|
||||
|
@ -261,9 +261,7 @@ void ro_gui_dialog_click_config(wimp_pointer *pointer)
|
||||
get_browser_choices();
|
||||
get_proxy_choices();
|
||||
get_theme_choices();
|
||||
xosfile_create_dir("<Choices$Write>.WWW", 0);
|
||||
xosfile_create_dir("<Choices$Write>.WWW.NetSurf", 0);
|
||||
options_write("<Choices$Write>.WWW.NetSurf.Choices");
|
||||
ro_gui_save_options();
|
||||
if (pointer->buttons == wimp_CLICK_SELECT) {
|
||||
ro_gui_dialog_close(dialog_config_br);
|
||||
ro_gui_dialog_close(dialog_config_prox);
|
||||
@ -294,6 +292,14 @@ void ro_gui_dialog_click_config(wimp_pointer *pointer)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the current options
|
||||
*/
|
||||
void ro_gui_save_options(void) {
|
||||
xosfile_create_dir("<Choices$Write>.WWW", 0);
|
||||
xosfile_create_dir("<Choices$Write>.WWW.NetSurf", 0);
|
||||
options_write("<Choices$Write>.WWW.NetSurf.Choices");
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle clicks in the Browser Choices dialog.
|
||||
|
@ -125,6 +125,7 @@ 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_click(wimp_pointer *pointer);
|
||||
void ro_gui_save_options(void);
|
||||
bool ro_gui_dialog_keypress(wimp_key *key);
|
||||
void ro_gui_dialog_close(wimp_w close);
|
||||
void ro_gui_redraw_config_th_pane(wimp_draw *redraw);
|
||||
|
@ -39,6 +39,7 @@ extern int option_window_width;
|
||||
extern int option_window_height;
|
||||
extern int option_window_screen_width;
|
||||
extern int option_window_screen_height;
|
||||
extern bool option_window_stagger;
|
||||
extern int option_minimum_gif_delay;
|
||||
extern bool option_background_images;
|
||||
extern bool option_background_blending;
|
||||
@ -67,6 +68,7 @@ int option_window_width = 0; \
|
||||
int option_window_height = 0; \
|
||||
int option_window_screen_width = 0; \
|
||||
int option_window_screen_height = 0; \
|
||||
bool option_window_stagger = true; \
|
||||
int option_minimum_gif_delay = 10; \
|
||||
bool option_background_images = true; \
|
||||
bool option_background_blending = false;
|
||||
@ -95,6 +97,7 @@ bool option_background_blending = false;
|
||||
{ "window_height", OPTION_INTEGER, &option_window_height }, \
|
||||
{ "window_screen_width", OPTION_INTEGER, &option_window_screen_width }, \
|
||||
{ "window_screen_height", OPTION_INTEGER, &option_window_screen_height }, \
|
||||
{ "window_stagger", OPTION_BOOL, &option_window_stagger }, \
|
||||
{ "minimum_gif_delay", OPTION_INTEGER, &option_minimum_gif_delay }, \
|
||||
{ "background_images", OPTION_BOOL, &option_background_images }, \
|
||||
{ "background_blending", OPTION_BOOL, &option_background_blending }
|
||||
|
@ -52,6 +52,7 @@ gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
wimp_window window;
|
||||
wimp_window_state state;
|
||||
os_error *error;
|
||||
bool open_centred = true;
|
||||
|
||||
gui_window *g = malloc(sizeof *g);
|
||||
if (!g) {
|
||||
@ -70,18 +71,53 @@ gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
g->throbber = 0;
|
||||
g->throbtime = 0;
|
||||
|
||||
ro_gui_screen_size(&screen_width, &screen_height);
|
||||
/* Set the window position
|
||||
*/
|
||||
if (clone && clone->window) {
|
||||
state.w = clone->window->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);
|
||||
}
|
||||
window.visible.x0 = state.visible.x0;
|
||||
window.visible.x1 = state.visible.x1;
|
||||
window.visible.y0 = state.visible.y0 - 48;
|
||||
window.visible.y1 = state.visible.y1 - 48;
|
||||
open_centred = false;
|
||||
} else {
|
||||
ro_gui_screen_size(&screen_width, &screen_height);
|
||||
|
||||
/* Check if we have a preferred position
|
||||
*/
|
||||
if ((option_window_screen_width != 0) && (option_window_screen_height != 0)) {
|
||||
win_width = (option_window_width * screen_width) / option_window_screen_width;
|
||||
win_height = (option_window_height * screen_height) / option_window_screen_height;
|
||||
window.visible.x0 = (option_window_x * screen_width) / option_window_screen_width;
|
||||
window.visible.y0 = (option_window_y * screen_height) / option_window_screen_height;
|
||||
if (option_window_stagger) {
|
||||
window.visible.y0 += 96 - (48 * (window_count % 5));
|
||||
}
|
||||
open_centred = false;
|
||||
if (100 < win_width) win_width = 100;
|
||||
if (100 < win_height) win_height = 100;
|
||||
} else {
|
||||
win_width = screen_width * 3 / 4;
|
||||
if (1600 < win_width)
|
||||
win_width = 1600;
|
||||
win_height = win_width * 3 / 4;
|
||||
|
||||
win_width = screen_width * 3 / 4;
|
||||
if (1600 < win_width)
|
||||
win_width = 1600;
|
||||
win_height = win_width * 3 / 4;
|
||||
|
||||
window.visible.x0 = (screen_width - win_width) / 2;
|
||||
window.visible.y0 = ((screen_height - win_height) / 2) + 96 -
|
||||
(48 * (window_count % 5));
|
||||
window.visible.x1 = window.visible.x0 + win_width;
|
||||
window.visible.y1 = window.visible.y0 + win_height;
|
||||
window.visible.x0 = (screen_width - win_width) / 2;
|
||||
window.visible.y0 = ((screen_height - win_height) / 2) + 96 -
|
||||
(48 * (window_count % 5));
|
||||
}
|
||||
window.visible.x1 = window.visible.x0 + win_width;
|
||||
window.visible.y1 = window.visible.y0 + win_height;
|
||||
}
|
||||
|
||||
/* Set the general window characteristics
|
||||
*/
|
||||
window.xscroll = 0;
|
||||
window.yscroll = 0;
|
||||
window.next = wimp_TOP;
|
||||
@ -106,8 +142,8 @@ gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
window.highlight_bg = wimp_COLOUR_CREAM;
|
||||
window.extra_flags = 0;
|
||||
window.extent.x0 = 0;
|
||||
window.extent.y0 = win_height;
|
||||
window.extent.x1 = win_width;
|
||||
window.extent.y0 = window.visible.y1 - window.visible.y0;
|
||||
window.extent.x1 = window.visible.x1 - window.visible.x0;
|
||||
window.extent.y1 = 0;
|
||||
window.title_flags = wimp_ICON_TEXT |
|
||||
wimp_ICON_INDIRECTED |
|
||||
@ -152,8 +188,16 @@ gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
warn_user("WimpError", error->errmess);
|
||||
return g;
|
||||
}
|
||||
scroll_width = ro_get_vscroll_width(g->window);
|
||||
state.visible.x0 -= scroll_width;
|
||||
|
||||
/* Only fix the centralisation if we've opened the window centred
|
||||
*/
|
||||
if (open_centred) {
|
||||
scroll_width = ro_get_vscroll_width(g->window);
|
||||
state.visible.x0 -= scroll_width;
|
||||
}
|
||||
|
||||
/* Open the window at the top of the stack
|
||||
*/
|
||||
state.next = wimp_TOP;
|
||||
ro_gui_window_open(g, (wimp_open*)&state);
|
||||
|
||||
@ -460,6 +504,8 @@ void ro_gui_window_open(gui_window *g, wimp_open *open) {
|
||||
int toolbar_height = 0;
|
||||
struct content *content;
|
||||
wimp_window_state state;
|
||||
bool toggle_hack = false;
|
||||
int screen_height, screen_width;
|
||||
|
||||
if (g->type != GUI_BROWSER_WINDOW) {
|
||||
wimp_open_window(open);
|
||||
@ -468,15 +514,21 @@ void ro_gui_window_open(gui_window *g, wimp_open *open) {
|
||||
|
||||
content = g->data.browser.bw->current_content;
|
||||
|
||||
/* check for toggle to full size */
|
||||
/* check for toggle to full size - NOW FEATURING "TEMPORARY HACK" */
|
||||
state.w = g->window;
|
||||
wimp_get_window_state(&state);
|
||||
if ((state.flags & wimp_WINDOW_TOGGLED) &&
|
||||
(state.flags & wimp_WINDOW_BOUNDED_ONCE) &&
|
||||
!(state.flags & wimp_WINDOW_FULL_SIZE)) {
|
||||
open->visible.y0 = 0;
|
||||
open->visible.y1 = 0x1000;
|
||||
height = 0x1000;
|
||||
/* Check if we need to perform our hack
|
||||
*/
|
||||
ro_gui_screen_size(&screen_width, &screen_height);
|
||||
if ((content->height * 2 * g->scale) < screen_height) {
|
||||
open->visible.y0 = 0;
|
||||
open->visible.y1 = 0x1000;
|
||||
height = 0x1000;
|
||||
toggle_hack = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* account for toolbar height, if present */
|
||||
@ -511,9 +563,7 @@ void ro_gui_window_open(gui_window *g, wimp_open *open) {
|
||||
wimp_open_window(open);
|
||||
|
||||
/* update extent to actual size if toggled */
|
||||
if ((state.flags & wimp_WINDOW_TOGGLED) &&
|
||||
(state.flags & wimp_WINDOW_BOUNDED_ONCE) &&
|
||||
!(state.flags & wimp_WINDOW_FULL_SIZE)) {
|
||||
if (toggle_hack) {
|
||||
width = open->visible.x1 - open->visible.x0;
|
||||
height = open->visible.y1 - open->visible.y0 - toolbar_height;
|
||||
if (content && (unsigned int)height <
|
||||
|
Loading…
x
Reference in New Issue
Block a user