mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-12 04:24:22 +03:00
Merge branch 'master' of git://git.netsurf-browser.org/netsurf
This commit is contained in:
commit
72fe92d9ca
@ -52,7 +52,6 @@
|
||||
#include "atari/settings.h"
|
||||
#include "cflib.h"
|
||||
|
||||
extern const char * cfg_homepage_url;
|
||||
extern struct gui_window *input_window;
|
||||
extern OBJECT * h_gem_menu;
|
||||
extern int mouse_click_time[3];
|
||||
@ -60,7 +59,14 @@ extern int mouse_hold_start[3];
|
||||
extern browser_mouse_state bmstate;
|
||||
extern short last_drag_x;
|
||||
extern short last_drag_y;
|
||||
extern bool html_redraw_debug;
|
||||
extern bool html_redraw_debug;
|
||||
|
||||
extern const char * option_homepage_url;
|
||||
extern int option_window_width;
|
||||
extern int option_window_height;
|
||||
extern int option_window_x;
|
||||
extern int option_window_y;
|
||||
extern char options[PATH_MAX];
|
||||
|
||||
/* Zero based resource tree ids: */
|
||||
#define T_ABOUT 0
|
||||
@ -96,7 +102,7 @@ static void __CDECL menu_about(WINDOW *win, int item, int title, void *data)
|
||||
static void __CDECL menu_new_win(WINDOW *win, int item, int title, void *data)
|
||||
{
|
||||
LOG(("%s", __FUNCTION__));
|
||||
browser_window_create(cfg_homepage_url, 0, 0, true, false);
|
||||
browser_window_create(option_homepage_url, 0, 0, true, false);
|
||||
}
|
||||
|
||||
static void __CDECL menu_open_url(WINDOW *win, int item, int title, void *data)
|
||||
@ -257,7 +263,21 @@ static void __CDECL menu_toolbars(WINDOW *win, int item, int title, void *data)
|
||||
|
||||
static void __CDECL menu_savewin(WINDOW *win, int item, int title, void *data)
|
||||
{
|
||||
LOG(("%s", __FUNCTION__));
|
||||
LOG(("%s", __FUNCTION__));
|
||||
if (input_window && input_window->browser) {
|
||||
GRECT rect;
|
||||
wind_get_grect(input_window->root->handle->handle, WF_CURRXYWH, &rect);
|
||||
option_window_width = rect.g_w;
|
||||
option_window_height = rect.g_h;
|
||||
option_window_x = rect.g_x;
|
||||
option_window_y = rect.g_y;
|
||||
nsoption_set_int(window_width, rect.g_w);
|
||||
nsoption_set_int(window_height, rect.g_h);
|
||||
nsoption_set_int(window_x, rect.g_x);
|
||||
nsoption_set_int(window_y, rect.g_y);
|
||||
nsoption_write((const char*)&options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void __CDECL menu_debug_render(WINDOW *win, int item, int title, void *data)
|
||||
|
54
atari/gui.c
54
atari/gui.c
@ -91,11 +91,13 @@ bool rendering = false;
|
||||
|
||||
|
||||
/* Comandline / Options: */
|
||||
int cfg_width;
|
||||
int cfg_height;
|
||||
int option_window_width;
|
||||
int option_window_height;
|
||||
int option_window_x;
|
||||
int option_window_y;
|
||||
|
||||
/* Defaults to option_homepage_url, commandline options overwrites that value */
|
||||
const char * cfg_homepage_url;
|
||||
const char * option_homepage_url;
|
||||
|
||||
/* path to choices file: */
|
||||
char options[PATH_MAX];
|
||||
@ -173,8 +175,8 @@ gui_create_browser_window(struct browser_window *bw,
|
||||
window_create(gw, bw, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE|WIDGET_SCROLL );
|
||||
if( gw->root->handle ) {
|
||||
GRECT pos = {
|
||||
app.w/2-(cfg_width/2), (app.h/2)-(cfg_height/2)+16,
|
||||
cfg_width, cfg_height
|
||||
option_window_x, option_window_y,
|
||||
option_window_width, option_window_height
|
||||
};
|
||||
window_open( gw , pos );
|
||||
/* Recalculate windows browser area now */
|
||||
@ -841,37 +843,51 @@ void gui_quit(void)
|
||||
static bool
|
||||
process_cmdline(int argc, char** argv)
|
||||
{
|
||||
int opt;
|
||||
int opt;
|
||||
bool set_default_dimensions = true;
|
||||
|
||||
LOG(("argc %d, argv %p", argc, argv));
|
||||
|
||||
if ((nsoption_int(window_width) != 0) && (nsoption_int(window_height) != 0)) {
|
||||
cfg_width = nsoption_int(window_width);
|
||||
cfg_height = nsoption_int(window_height);
|
||||
} else {
|
||||
|
||||
option_window_width = nsoption_int(window_width);
|
||||
option_window_height = nsoption_int(window_height);
|
||||
option_window_x = nsoption_int(window_x);
|
||||
option_window_y = nsoption_int(window_y);
|
||||
|
||||
if (option_window_width <= app.w && option_window_height < app.h) {
|
||||
set_default_dimensions = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (set_default_dimensions) {
|
||||
if( sys_type() == SYS_TOS ){
|
||||
/* on single tasking OS, start as fulled window: */
|
||||
cfg_width = app.w;
|
||||
cfg_height = app.h;
|
||||
option_window_width = app.w;
|
||||
option_window_height = app.h-20;
|
||||
option_window_x = app.w/2-(option_window_width/2);
|
||||
option_window_y = (app.h/2)-(option_window_height/2);
|
||||
} else {
|
||||
cfg_width = 600;
|
||||
cfg_height = 360;
|
||||
option_window_width = 600;
|
||||
option_window_height = 360;
|
||||
option_window_x = 10;
|
||||
option_window_y = 30;
|
||||
}
|
||||
}
|
||||
|
||||
if (nsoption_charp(homepage_url) != NULL)
|
||||
cfg_homepage_url = nsoption_charp(homepage_url);
|
||||
option_homepage_url = nsoption_charp(homepage_url);
|
||||
else
|
||||
cfg_homepage_url = NETSURF_HOMEPAGE;
|
||||
option_homepage_url = NETSURF_HOMEPAGE;
|
||||
|
||||
while((opt = getopt(argc, argv, "w:h:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'w':
|
||||
cfg_width = atoi(optarg);
|
||||
option_window_width = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
cfg_height = atoi(optarg);
|
||||
option_window_height = atoi(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -883,7 +899,7 @@ process_cmdline(int argc, char** argv)
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
cfg_homepage_url = argv[optind];
|
||||
option_homepage_url = argv[optind];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1014,7 +1030,7 @@ int main(int argc, char** argv)
|
||||
netsurf_init(&argc, &argv, options, messages);
|
||||
gui_init(argc, argv);
|
||||
gui_init2(argc, argv);
|
||||
browser_window_create(cfg_homepage_url, 0, 0, true, false);
|
||||
browser_window_create(option_homepage_url, 0, 0, true, false);
|
||||
graf_mouse( ARROW , NULL);
|
||||
netsurf_main_loop();
|
||||
netsurf_exit();
|
||||
|
@ -55,12 +55,14 @@ char **global_history_get_recent( int *count )
|
||||
|
||||
void global_history_open( void )
|
||||
{
|
||||
if( gl_history.init == false ) {
|
||||
GRECT pos = {app.w - (app.w/3), app.y, app.w/3, app.h/2};
|
||||
|
||||
if (gl_history.init == false ) {
|
||||
printf("history not init");
|
||||
return;
|
||||
}
|
||||
if( gl_history.open == false ) {
|
||||
WindOpen( gl_history.window, -1, -1, app.w/3, app.h/2);
|
||||
WindOpen( gl_history.window, pos.g_x, pos.g_y, pos.g_w, pos.g_h);
|
||||
gl_history.open = true;
|
||||
atari_treeview_open( gl_history.tv );
|
||||
} else {
|
||||
|
@ -134,11 +134,14 @@ void hotlist_init(void)
|
||||
|
||||
void hotlist_open(void)
|
||||
{
|
||||
GRECT pos = {app.w - (app.w/3), app.y, app.w/3, app.h/2};
|
||||
|
||||
if( hl.init == false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( hl.open == false ) {
|
||||
WindOpen( hl.window, -1, -1, app.w/3, app.h/2);
|
||||
WindOpen( hl.window, pos.g_x, pos.g_y, pos.g_w, pos.g_h);
|
||||
hl.open = true;
|
||||
atari_treeview_open( hl.tv );
|
||||
} else {
|
||||
|
@ -238,24 +238,38 @@ void search_destroy( struct gui_window * gw )
|
||||
SEARCH_FORM_SESSION open_browser_search( struct gui_window * gw )
|
||||
{
|
||||
char * title;
|
||||
SEARCH_FORM_SESSION sfs;
|
||||
SEARCH_FORM_SESSION sfs;
|
||||
GRECT pos, treesize;
|
||||
OBJECT * tree = get_tree(SEARCH);
|
||||
if( tree == NULL ){
|
||||
return( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
sfs = calloc(1, sizeof(struct s_search_form_session));
|
||||
if( sfs == NULL )
|
||||
return( NULL );
|
||||
|
||||
title = (char*)messages_get("FindTextNS");
|
||||
if( title == NULL )
|
||||
title = (char*)"Find text ...";
|
||||
|
||||
search_destroy( gw );
|
||||
current = sfs;
|
||||
search_destroy( gw );
|
||||
|
||||
/* setup dipslay position: right corner */
|
||||
treesize.g_x = 0;
|
||||
treesize.g_y = 0;
|
||||
treesize.g_w = tree->ob_width;
|
||||
treesize.g_h = tree->ob_height;
|
||||
wind_calc_grect(WC_BORDER, WAT_FORM, &treesize, &pos);
|
||||
pos.g_x = app.w - pos.g_w;
|
||||
pos.g_y = app.h - pos.g_h;
|
||||
|
||||
|
||||
current = sfs;
|
||||
sfs->bw = gw->browser->bw;
|
||||
sfs->formwind = mt_FormCreate( &app, tree, WAT_FORM,
|
||||
NULL, title,
|
||||
NULL, true, false);
|
||||
&pos, true, false);
|
||||
|
||||
ObjcAttachFormFunc( sfs->formwind, SEARCH_BT_SEARCH, evnt_bt_srch_click, NULL);
|
||||
ObjcAttachFormFunc( sfs->formwind, SEARCH_CB_CASESENSE, evnt_cb_click, NULL);
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "atari/res/netsurf.rsh"
|
||||
|
||||
|
||||
extern char * cfg_homepage_url;
|
||||
extern char * option_homepage_url;
|
||||
extern void * h_gem_rsrc;
|
||||
extern struct gui_window * input_window;
|
||||
extern long atari_plot_flags;
|
||||
@ -302,19 +302,19 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
|
||||
while( (todo.g_w > 0) && (todo.g_h > 0) ){
|
||||
|
||||
if (rc_intersect(&crect, &todo )) {
|
||||
|
||||
|
||||
struct rect bgclip = {0,0,todo.g_w, todo.g_h};
|
||||
pxy[0] = todo.g_x;
|
||||
pxy[1] = todo.g_y;
|
||||
pxy[2] = todo.g_w + todo.g_x-1;
|
||||
pxy[3] = todo.g_h + todo.g_y-1;
|
||||
|
||||
|
||||
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
|
||||
plot_set_dimensions(todo.g_x, todo.g_y, todo.g_w, todo.g_h);
|
||||
plot_rectangle(0, 0, crect.g_w, crect.g_h, &plot_style_background);
|
||||
|
||||
|
||||
if( img_toolbar == true ){
|
||||
plot_set_dimensions(icon_dim.g_x, icon_dim.g_y,
|
||||
plot_set_dimensions(icon_dim.g_x, icon_dim.g_y,
|
||||
icon_dim.g_w, icon_dim.g_h);
|
||||
plot_clip( &icon_clip );
|
||||
atari_plotters.bitmap( bmpx, bmpy, bmpw, bmph, icon,
|
||||
@ -403,11 +403,11 @@ void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
|
||||
pxy[2] = (short)buff[4] + buff[6]-1;
|
||||
pxy[3] = (short)buff[5] + buff[7]-2;
|
||||
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
|
||||
|
||||
|
||||
if (app.nplanes > 2 ) {
|
||||
plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
|
||||
plot_rectangle( 0, 0, work.g_w, work.g_h, &plot_style_background);
|
||||
}
|
||||
}
|
||||
else {
|
||||
vsf_color(atari_plot_vdi_handle, WHITE );
|
||||
v_bar(atari_plot_vdi_handle, (short*)&pxy );
|
||||
@ -502,20 +502,20 @@ void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8], void * data)
|
||||
if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
|
||||
|
||||
plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
|
||||
|
||||
|
||||
//left margin:
|
||||
plot_rectangle(0, 0, TOOLBAR_URL_MARGIN_LEFT, work.g_h,
|
||||
plot_rectangle(0, 0, TOOLBAR_URL_MARGIN_LEFT, work.g_h,
|
||||
&plot_style_background);
|
||||
// right margin:
|
||||
plot_rectangle(work.g_w-TOOLBAR_URL_MARGIN_RIGHT, 0, work.g_w, work.g_h,
|
||||
plot_rectangle(work.g_w-TOOLBAR_URL_MARGIN_RIGHT, 0, work.g_w, work.g_h,
|
||||
&plot_style_background);
|
||||
|
||||
// top margin:
|
||||
plot_rectangle(0, 0, work.g_w, TOOLBAR_URL_MARGIN_TOP,
|
||||
plot_rectangle(0, 0, work.g_w, TOOLBAR_URL_MARGIN_TOP,
|
||||
&plot_style_background);
|
||||
|
||||
// bottom margin:
|
||||
plot_rectangle(0, work.g_h-TOOLBAR_URL_MARGIN_BOTTOM, work.g_w, work.g_h,
|
||||
plot_rectangle(0, work.g_h-TOOLBAR_URL_MARGIN_BOTTOM, work.g_w, work.g_h,
|
||||
&plot_style_background);
|
||||
|
||||
// TBD: request redraw of textarea for specific region.
|
||||
@ -612,7 +612,7 @@ static void __CDECL evnt_toolbar_redraw( COMPONENT *c, long buff[8], void *data
|
||||
clip = work;
|
||||
if( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
|
||||
if( work.g_y + work.g_h != clip.g_y + clip.g_h ) return;
|
||||
|
||||
|
||||
vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
|
||||
vsl_color(atari_plot_vdi_handle, BLACK );
|
||||
vsl_type(atari_plot_vdi_handle, 1 );
|
||||
@ -1019,13 +1019,13 @@ void tb_forward_click( struct gui_window * gw )
|
||||
|
||||
void tb_home_click( struct gui_window * gw )
|
||||
{
|
||||
browser_window_go(gw->browser->bw, cfg_homepage_url, 0, true);
|
||||
browser_window_go(gw->browser->bw, option_homepage_url, 0, true);
|
||||
}
|
||||
|
||||
|
||||
void tb_stop_click( struct gui_window * gw )
|
||||
{
|
||||
browser_window_stop( gw->browser->bw );
|
||||
browser_window_stop(gw->browser->bw);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user