Pass whether background images are wanted in redraw_context.

svn path=/trunk/netsurf/; revision=13335
This commit is contained in:
Michael Drake 2011-12-23 22:39:25 +00:00
parent 879383e21e
commit 67f2470d5a
33 changed files with 614 additions and 576 deletions

View File

@ -3170,6 +3170,7 @@ void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw,
int posx, posy;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &amiplot
};
@ -3373,6 +3374,7 @@ void ami_do_redraw(struct gui_window_2 *g)
struct rect clip;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &amiplot
};

View File

@ -159,6 +159,7 @@ void ami_history_redraw(struct history_window *hw)
ULONG xs,ys;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &amiplot
};

View File

@ -44,6 +44,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
int plot_height;
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &amiplot
};

View File

@ -1218,6 +1218,7 @@ void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
int pos_x, pos_y;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &amiplot
};

View File

@ -13,12 +13,12 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Module Description:
*
* This WinDom compo
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Module Description:
*
* This WinDom compo
*
*
*/
@ -33,9 +33,9 @@
#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "desktop/browser.h"
#include "desktop/browser.h"
#include "desktop/mouse.h"
#include "desktop/textinput.h"
#include "desktop/textinput.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
@ -49,34 +49,34 @@
#include "atari/browser_win.h"
#include "atari/misc.h"
#include "atari/global_evnt.h"
#include "atari/res/netsurf.rsh"
#include "atari/res/netsurf.rsh"
#include "atari/redrawslots.h"
#include "atari/browser.h"
#include "atari/plot/plotter.h"
#include "atari/plot.h"
#include "atari/encoding.h"
#include "atari/ctxmenu.h"
#include "atari/encoding.h"
#include "atari/ctxmenu.h"
#include "cflib.h"
extern GEM_PLOTTER plotter;
extern struct gui_window *input_window;
static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect );
static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
struct rect * area );
static void __CDECL browser_evnt_destroy( COMPONENT * c, long buff[8],
static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect );
static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
struct rect * area );
static void __CDECL browser_evnt_destroy( COMPONENT * c, long buff[8],
void * data);
static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8],
static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8],
void * data);
static void __CDECL browser_evnt_mbutton( COMPONENT * c, long buff[8],
static void __CDECL browser_evnt_mbutton( COMPONENT * c, long buff[8],
void * data);
/*
Create an browser component.
Currently, this area is the area which is used to display HTML content.
However, it could also contains other areas, these need to be handled within
"browser_get_rect" function.
/*
Create an browser component.
Currently, this area is the area which is used to display HTML content.
However, it could also contains other areas, these need to be handled within
"browser_get_rect" function.
*/
struct s_browser * browser_create
(
@ -95,34 +95,34 @@ struct s_browser * browser_create
if(clone)
bw->scale = clone->scale;
else
bw->scale = 1;
bw->scale = 1;
redraw_slots_init( &bnew->redraw, MAX_REDRW_SLOTS );
bnew->comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, 100, 1);
if( bnew->comp == NULL ) {
free(bnew);
return(NULL);
}
}
/* Attach events to the component: */
mt_CompEvntDataAdd( &app, bnew->comp, WM_XBUTTON,
browser_evnt_mbutton, (void*)gw, EV_BOT
browser_evnt_mbutton, (void*)gw, EV_BOT
);
mt_CompEvntDataAttach( &app, bnew->comp, WM_REDRAW,
browser_evnt_redraw, (void*)gw
browser_evnt_redraw, (void*)gw
);
mt_CompEvntDataAttach( &app, bnew->comp, WM_DESTROY,
browser_evnt_destroy, (void*)bnew
);
/* Set the gui_window owner. */
browser_evnt_destroy, (void*)bnew
);
/* Set the gui_window owner. */
/* it is an link to the netsurf window system */
mt_CompDataAttach( &app, bnew->comp, CDT_OWNER, gw );
bnew->scroll.requested.y = 0;
bnew->scroll.requested.x = 0;
bnew->scroll.current.x = 0;
bnew->scroll.current.y = 0;
bnew->reformat_pending = false;
bnew->scroll.current.y = 0;
bnew->reformat_pending = false;
}
return( bnew );
@ -131,37 +131,37 @@ struct s_browser * browser_create
bool browser_destroy( struct s_browser * b )
{
LOG(("%s\n", b->bw->name ));
LOG(("%s\n", b->bw->name ));
assert( b != NULL );
assert( b->comp != NULL );
assert( b->bw != NULL );
if( b->comp != NULL ){
mt_CompDelete(&app, b->comp );
if( b->comp != NULL ){
mt_CompDelete(&app, b->comp );
}
return( true );
}
/*
Query the browser component for widget rectangles.
/*
Query the browser component for widget rectangles.
*/
void browser_get_rect( struct gui_window * gw, enum browser_rect type, LGRECT * out)
{
LGRECT cur;
/* Query component for it's current size: */
mt_CompGetLGrect(&app, gw->browser->comp, WF_WORKXYWH, &cur);
/* And extract the different widget dimensions: */
{
LGRECT cur;
/* Query component for it's current size: */
mt_CompGetLGrect(&app, gw->browser->comp, WF_WORKXYWH, &cur);
/* And extract the different widget dimensions: */
if( type == BR_CONTENT ){
out->g_w = cur.g_w;
out->g_h = cur.g_h;
out->g_x = cur.g_x;
out->g_y = cur.g_y;
}
return;
return;
}
/* Report an resize to the COMPONENT interface */
@ -172,18 +172,18 @@ void browser_update_rects(struct gui_window * gw )
buff[0] = CM_REFLOW;
buff[1] = _AESapid;
buff[2] = 0;
EvntExec(gw->root->handle, buff);
}
EvntExec(gw->root->handle, buff);
}
void browser_set_content_size(struct gui_window * gw, int w, int h)
{
CMP_BROWSER b = gw->browser;
LGRECT work;
browser_get_rect( gw, BR_CONTENT, &work );
gw->root->handle->xpos_max = w;
gw->root->handle->ypos_max = h;
browser_get_rect( gw, BR_CONTENT, &work );
gw->root->handle->xpos_max = w;
gw->root->handle->ypos_max = h;
if( w < work.g_w + b->scroll.current.x || w < work.g_h + b->scroll.current.y ) {
/* let the scroll routine detect invalid scroll values... */
browser_scroll(gw, WA_LFLINE, b->scroll.current.x, true );
@ -191,8 +191,8 @@ void browser_set_content_size(struct gui_window * gw, int w, int h)
/* force update of scrollbars: */
b->scroll.required = true;
}
}
}
static void __CDECL browser_evnt_destroy( COMPONENT * c, long buff[8], void * data)
{
@ -206,29 +206,29 @@ static void __CDECL browser_evnt_destroy( COMPONENT * c, long buff[8], void * da
gw->browser = NULL;
LOG(("evnt_destroy done!"));
}
/*
Mouse Button handler for browser component.
*/
/*
Mouse Button handler for browser component.
*/
static void __CDECL browser_evnt_mbutton( COMPONENT * c, long buff[8], void * data)
{
{
short mx, my, dummy, mbut;
LGRECT cwork;
LGRECT cwork;
browser_mouse_state bmstate = 0;
struct gui_window * gw = data;
if( input_window != gw ){
input_window = gw;
}
struct gui_window * gw = data;
if( input_window != gw ){
input_window = gw;
}
window_set_focus( gw, BROWSER, (void*)gw->browser );
browser_get_rect( gw, BR_CONTENT, &cwork );
browser_get_rect( gw, BR_CONTENT, &cwork );
/* convert screen coords to component coords: */
mx = evnt.mx - cwork.g_x;
my = evnt.my - cwork.g_y;
my = evnt.my - cwork.g_y;
/* Translate GEM key state to netsurf mouse modifier */
if( evnt.mkstate & (K_RSHIFT | K_LSHIFT) ){
bmstate |= BROWSER_MOUSE_MOD_1;
@ -244,60 +244,60 @@ static void __CDECL browser_evnt_mbutton( COMPONENT * c, long buff[8], void * da
bmstate |= BROWSER_MOUSE_MOD_3;
} else {
bmstate &= ~(BROWSER_MOUSE_MOD_3);
}
}
/* convert component coords to scrolled content coords: */
int sx_origin = (mx + gw->browser->scroll.current.x);
int sy_origin = (my + gw->browser->scroll.current.y);
short rel_cur_x, rel_cur_y;
short prev_x=sx_origin, prev_y=sy_origin;
/* Detect left mouse button state and compare with event state: */
graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy);
if( (mbut & 1) && (evnt.mbut & 1) ){
/* Mouse still pressed, report drag */
rel_cur_x = (rel_cur_x - cwork.g_x) + gw->browser->scroll.current.x;
rel_cur_y = (rel_cur_y - cwork.g_y) + gw->browser->scroll.current.y;
browser_window_mouse_click( gw->browser->bw,
BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_DRAG_1,
sx_origin, sy_origin);
do{
if( abs(prev_x-rel_cur_x) > 5 || abs(prev_y-rel_cur_y) > 5 ){
browser_window_mouse_track( gw->browser->bw,
BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_HOLDING_1,
rel_cur_x, rel_cur_y);
prev_x = rel_cur_x;
prev_y = rel_cur_y;
if( browser_redraw_required( gw ) ){
browser_redraw( gw );
}
}
graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy);
rel_cur_x = (rel_cur_x - cwork.g_x) + gw->browser->scroll.current.x;
rel_cur_y = (rel_cur_y - cwork.g_y) + gw->browser->scroll.current.y;
} while( mbut & 1 );
browser_window_mouse_track(gw->browser->bw, 0, rel_cur_x,rel_cur_y);
} else {
/* Right button pressed? */
if( (evnt.mbut & 2 ) ) {
context_popup( gw, evnt.mx, evnt.my );
} else {
browser_window_mouse_click(gw->browser->bw,
bmstate|BROWSER_MOUSE_PRESS_1,
sx_origin,sy_origin);
browser_window_mouse_click(gw->browser->bw,
bmstate|BROWSER_MOUSE_CLICK_1,
sx_origin,sy_origin);
}
}
}
int sy_origin = (my + gw->browser->scroll.current.y);
/*
Report scroll event to the browser component.
short rel_cur_x, rel_cur_y;
short prev_x=sx_origin, prev_y=sy_origin;
/* Detect left mouse button state and compare with event state: */
graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy);
if( (mbut & 1) && (evnt.mbut & 1) ){
/* Mouse still pressed, report drag */
rel_cur_x = (rel_cur_x - cwork.g_x) + gw->browser->scroll.current.x;
rel_cur_y = (rel_cur_y - cwork.g_y) + gw->browser->scroll.current.y;
browser_window_mouse_click( gw->browser->bw,
BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_DRAG_1,
sx_origin, sy_origin);
do{
if( abs(prev_x-rel_cur_x) > 5 || abs(prev_y-rel_cur_y) > 5 ){
browser_window_mouse_track( gw->browser->bw,
BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_HOLDING_1,
rel_cur_x, rel_cur_y);
prev_x = rel_cur_x;
prev_y = rel_cur_y;
if( browser_redraw_required( gw ) ){
browser_redraw( gw );
}
}
graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy);
rel_cur_x = (rel_cur_x - cwork.g_x) + gw->browser->scroll.current.x;
rel_cur_y = (rel_cur_y - cwork.g_y) + gw->browser->scroll.current.y;
} while( mbut & 1 );
browser_window_mouse_track(gw->browser->bw, 0, rel_cur_x,rel_cur_y);
} else {
/* Right button pressed? */
if( (evnt.mbut & 2 ) ) {
context_popup( gw, evnt.mx, evnt.my );
} else {
browser_window_mouse_click(gw->browser->bw,
bmstate|BROWSER_MOUSE_PRESS_1,
sx_origin,sy_origin);
browser_window_mouse_click(gw->browser->bw,
bmstate|BROWSER_MOUSE_CLICK_1,
sx_origin,sy_origin);
}
}
}
/*
Report scroll event to the browser component.
*/
void browser_scroll( struct gui_window * gw, short mode, int value, bool abs )
{
@ -474,80 +474,80 @@ static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect )
browser_schedule_redraw( gw, bwrect.g_w - w, 0, bwrect.g_w, bwrect.g_h );
}
b->scroll.requested.y = 0;
b->scroll.requested.x = 0;
if( b->caret.requested.g_w > 0 ){
b->caret.redraw = true;
b->scroll.requested.x = 0;
if( b->caret.requested.g_w > 0 ){
b->caret.redraw = true;
}
gw->root->handle->xpos = b->scroll.current.x;
gw->root->handle->ypos = b->scroll.current.y;
mt_WindSlider( &app, gw->root->handle, HSLIDER|VSLIDER );
}
/*
Report keypress to browser component.
The browser component doesn't listen for keyinput by itself.
parameter:
- gui_window ( compocnent owner ).
- unsigned short nkc ( CFLIB normalised key code )
/*
Report keypress to browser component.
The browser component doesn't listen for keyinput by itself.
parameter:
- gui_window ( compocnent owner ).
- unsigned short nkc ( CFLIB normalised key code )
*/
bool browser_input( struct gui_window * gw, unsigned short nkc )
{
LGRECT work;
bool r = false;
unsigned char ascii = (nkc & 0xFF);
long ucs4;
long ik = nkc_to_input_key( nkc, &ucs4 );
// pass event to specific control?
if( ik == 0 ){
long ucs4;
long ik = nkc_to_input_key( nkc, &ucs4 );
// pass event to specific control?
if( ik == 0 ){
if (ascii >= 9 ) {
r = browser_window_key_press(gw->browser->bw, ucs4 );
}
} else {
r = browser_window_key_press(gw->browser->bw, ik );
if( r == false ){
browser_get_rect(gw, BR_CONTENT, &work);
switch( ik ){
case KEY_LINE_START:
browser_scroll( gw, WA_LFPAGE, work.g_w, false );
break;
case KEY_LINE_END:
browser_scroll( gw, WA_RTPAGE, work.g_w, false );
break;
case KEY_PAGE_UP:
browser_scroll( gw, WA_UPPAGE, work.g_h, false );
break;
case KEY_PAGE_DOWN:
browser_scroll( gw, WA_DNPAGE, work.g_h, false );
break;
case KEY_RIGHT:
browser_scroll( gw, WA_RTLINE, 16, false );
break;
case KEY_LEFT:
browser_scroll( gw, WA_LFLINE, 16, false );
break;
case KEY_UP:
browser_scroll( gw, WA_UPLINE, 16, false);
break;
case KEY_DOWN:
browser_scroll( gw, WA_DNLINE, 16, false);
break;
default:
break;
}
}
}
}
} else {
r = browser_window_key_press(gw->browser->bw, ik );
if( r == false ){
browser_get_rect(gw, BR_CONTENT, &work);
switch( ik ){
case KEY_LINE_START:
browser_scroll( gw, WA_LFPAGE, work.g_w, false );
break;
case KEY_LINE_END:
browser_scroll( gw, WA_RTPAGE, work.g_w, false );
break;
case KEY_PAGE_UP:
browser_scroll( gw, WA_UPPAGE, work.g_h, false );
break;
case KEY_PAGE_DOWN:
browser_scroll( gw, WA_DNPAGE, work.g_h, false );
break;
case KEY_RIGHT:
browser_scroll( gw, WA_RTLINE, 16, false );
break;
case KEY_LEFT:
browser_scroll( gw, WA_LFLINE, 16, false );
break;
case KEY_UP:
browser_scroll( gw, WA_UPLINE, 16, false);
break;
case KEY_DOWN:
browser_scroll( gw, WA_DNLINE, 16, false);
break;
default:
break;
}
}
}
return( r );
}
@ -559,10 +559,10 @@ bool browser_redraw_required( struct gui_window * gw)
CMP_BROWSER b = gw->browser;
if( b->bw->current_content == NULL )
return ( false );
/* disable redraws when the browser awaits WM_REDRAW caused by resize */
if( b->reformat_pending )
return ( false );
/* disable redraws when the browser awaits WM_REDRAW caused by resize */
if( b->reformat_pending )
return( false );
ret = ( ((b->redraw.areas_used > 0) )
@ -607,18 +607,19 @@ void browser_schedule_redraw(struct gui_window * gw, short x0, short y0, short x
if( y0 > work.g_h )
return;
redraw_slot_schedule( &b->redraw, x0, y0, x1, y1 );
redraw_slot_schedule( &b->redraw, x0, y0, x1, y1 );
return;
}
static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
struct rect * area )
{
CMP_BROWSER b = gw->browser;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &atari_plotters
};
@ -631,80 +632,80 @@ static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
-b->scroll.current.y, area, &ctx );
}
/*
area: the browser canvas
*/
void browser_restore_caret_background( struct gui_window * gw, LGRECT * area)
{
CMP_BROWSER b = gw->browser;
LGRECT rect;
if( area == NULL ){
browser_get_rect( gw, BR_CONTENT, &rect );
area = &rect;
}
/* This call restores the background and releases the memory: */
// TODO: only release memory/clear flag when the caret is not clipped.
// TODO: apply clipping.
w_put_bkgr( &app,
area->g_x-b->scroll.current.x+b->caret.current.g_x,
area->g_y-b->scroll.current.y+b->caret.current.g_y,
gw->browser->caret.current.g_w,
gw->browser->caret.current.g_h,
&gw->browser->caret.background
);
gw->browser->caret.background.fd_addr = NULL;
/*
area: the browser canvas
*/
void browser_restore_caret_background( struct gui_window * gw, LGRECT * area)
{
CMP_BROWSER b = gw->browser;
LGRECT rect;
if( area == NULL ){
browser_get_rect( gw, BR_CONTENT, &rect );
area = &rect;
}
/* This call restores the background and releases the memory: */
// TODO: only release memory/clear flag when the caret is not clipped.
// TODO: apply clipping.
w_put_bkgr( &app,
area->g_x-b->scroll.current.x+b->caret.current.g_x,
area->g_y-b->scroll.current.y+b->caret.current.g_y,
gw->browser->caret.current.g_w,
gw->browser->caret.current.g_h,
&gw->browser->caret.background
);
gw->browser->caret.background.fd_addr = NULL;
}
/*
area: the browser canvas
/*
area: the browser canvas
*/
void browser_redraw_caret( struct gui_window * gw, LGRECT * area )
{
// TODO: only redraw caret when window is topped.
if( gw->browser->caret.redraw && gw->browser->caret.requested.g_w > 0 ){
if( gw->browser->caret.redraw && gw->browser->caret.requested.g_w > 0 ){
LGRECT caret;
struct s_browser * b = gw->browser;
struct rect old_clip;
struct rect clip;
if( b->caret.current.g_w > 0 && b->caret.background.fd_addr != NULL ){
browser_restore_caret_background( gw, area );
}
struct rect clip;
if( b->caret.current.g_w > 0 && b->caret.background.fd_addr != NULL ){
browser_restore_caret_background( gw, area );
}
caret = b->caret.requested;
caret.g_x -= b->scroll.current.x - area->g_x;
caret.g_y -= b->scroll.current.y - area->g_y;
if( !rc_lintersect( area, &caret ) ) {
return;
}
MFDB screen;
short pxy[8];
/* save background: */
//assert( b->caret.background.fd_addr == NULL );
init_mfdb( app.nplanes, caret.g_w, caret.g_h, 0,
&b->caret.background );
init_mfdb( 0, caret.g_w, caret.g_h, 0, &screen );
pxy[0] = caret.g_x;
pxy[1] = caret.g_y;
pxy[2] = caret.g_x + caret.g_w - 1;
pxy[3] = caret.g_y + caret.g_h - 1;
pxy[4] = 0;
pxy[5] = 0;
pxy[6] = caret.g_w - 1;
pxy[7] = caret.g_h - 1;
/* hide the mouse */
v_hide_c ( app.graf.handle);
/* copy screen image */
vro_cpyfm ( app.graf.handle, S_ONLY, pxy, &screen, &b->caret.background);
/* restore the mouse */
v_show_c ( app.graf.handle, 1);
/* draw caret: */
caret.g_x -= area->g_x;
caret.g_y -= area->g_y;
caret.g_y -= b->scroll.current.y - area->g_y;
if( !rc_lintersect( area, &caret ) ) {
return;
}
MFDB screen;
short pxy[8];
/* save background: */
//assert( b->caret.background.fd_addr == NULL );
init_mfdb( app.nplanes, caret.g_w, caret.g_h, 0,
&b->caret.background );
init_mfdb( 0, caret.g_w, caret.g_h, 0, &screen );
pxy[0] = caret.g_x;
pxy[1] = caret.g_y;
pxy[2] = caret.g_x + caret.g_w - 1;
pxy[3] = caret.g_y + caret.g_h - 1;
pxy[4] = 0;
pxy[5] = 0;
pxy[6] = caret.g_w - 1;
pxy[7] = caret.g_h - 1;
/* hide the mouse */
v_hide_c ( app.graf.handle);
/* copy screen image */
vro_cpyfm ( app.graf.handle, S_ONLY, pxy, &screen, &b->caret.background);
/* restore the mouse */
v_show_c ( app.graf.handle, 1);
/* draw caret: */
caret.g_x -= area->g_x;
caret.g_y -= area->g_y;
clip.x0 = caret.g_x;
clip.y0 = caret.g_y;
clip.x1 = caret.g_x + caret.g_w-1;
@ -712,14 +713,14 @@ void browser_redraw_caret( struct gui_window * gw, LGRECT * area )
/* store old clip before adjusting it: */
plot_get_clip( &old_clip );
/* clip to cursor: */
plot_clip( &clip );
plot_line( caret.g_x, caret.g_y, caret.g_x, caret.g_y + caret.g_h,
plot_clip( &clip );
plot_line( caret.g_x, caret.g_y, caret.g_x, caret.g_y + caret.g_h,
plot_style_caret );
/* restore old clip area: */
plot_clip( &old_clip );
b->caret.current.g_x = caret.g_x + gw->browser->scroll.current.x;
b->caret.current.g_y = caret.g_y + gw->browser->scroll.current.y;
b->caret.current.g_w = caret.g_w;
b->caret.current.g_w = caret.g_w;
b->caret.current.g_h = caret.g_h;
}
}
@ -729,7 +730,7 @@ void browser_redraw( struct gui_window * gw )
LGRECT bwrect;
struct s_browser * b = gw->browser;
short todo[4];
struct rect clip;
struct rect clip;
/* used for clipping of content redraw: */
struct rect redraw_area;
@ -737,7 +738,7 @@ void browser_redraw( struct gui_window * gw )
return;
}
browser_get_rect(gw, BR_CONTENT, &bwrect);
browser_get_rect(gw, BR_CONTENT, &bwrect);
plotter->resize(plotter, bwrect.g_w, bwrect.g_h);
plotter->move(plotter, bwrect.g_x, bwrect.g_y );
@ -746,7 +747,7 @@ void browser_redraw( struct gui_window * gw )
clip.x1 = bwrect.g_w;
clip.y1 = bwrect.g_h;
plotter->clip( plotter, &clip );
if( plotter->lock(plotter) == 0 )
if( plotter->lock(plotter) == 0 )
return;
if( b->scroll.required == true && b->bw->current_content != NULL) {
@ -792,7 +793,7 @@ void browser_redraw( struct gui_window * gw )
redraw_area.x0 = area.g_x;
redraw_area.y0 = area.g_y;
redraw_area.x1 = area.g_x + area.g_w;
redraw_area.y1 = area.g_y + area.g_h;
redraw_area.y1 = area.g_y + area.g_h;
browser_redraw_content( gw, 0, 0, &redraw_area );
} else {
/*
@ -814,7 +815,7 @@ void browser_redraw( struct gui_window * gw )
}
b->redraw.areas_used = 0;
}
if( b->caret.redraw == true && b->bw->current_content != NULL ) {
if( b->caret.redraw == true && b->bw->current_content != NULL ) {
LGRECT area;
todo[0] = bwrect.g_x;
todo[1] = bwrect.g_y;
@ -842,19 +843,19 @@ static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8], void * dat
browser_get_rect( gw, BR_CONTENT, &work );
lclip = work;
if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) return;
if( b->bw->current_content == NULL ){
short pxy[4];
pxy[0] = lclip.g_x;
pxy[1] = lclip.g_y;
pxy[2] = lclip.g_x + lclip.g_w - 1;
pxy[3] = lclip.g_y + lclip.g_h - 1;
if( b->bw->current_content == NULL ){
short pxy[4];
pxy[0] = lclip.g_x;
pxy[1] = lclip.g_y;
pxy[2] = lclip.g_x + lclip.g_w - 1;
pxy[3] = lclip.g_y + lclip.g_h - 1;
vsf_color( gw->root->handle->graf->handle, WHITE );
vsf_perimeter( gw->root->handle->graf->handle, 0);
vsf_interior( gw->root->handle->graf->handle, FIS_SOLID );
vsf_style( gw->root->handle->graf->handle, 1);
v_bar( gw->root->handle->graf->handle, (short*)&pxy );
return;
v_bar( gw->root->handle->graf->handle, (short*)&pxy );
return;
}
/* convert redraw coords to framebuffer coords: */
@ -871,22 +872,22 @@ static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8], void * dat
lclip.g_y = 0;
}
if( lclip.g_h > 0 && lclip.g_w > 0 ) {
if( gw->browser->reformat_pending == true ){
LGRECT newsize;
gw->browser->reformat_pending = false;
browser_get_rect(gw, BR_CONTENT, &newsize);
/* this call will also schedule an redraw for the complete */
/* area. */
/* Resize must be handled here, because otherwise */
/* a redraw is scheduled twice (1. by the frontend, 2. by AES) */
browser_window_reformat(b->bw, false, newsize.g_w, newsize.g_h );
} else {
if( lclip.g_h > 0 && lclip.g_w > 0 ) {
if( gw->browser->reformat_pending == true ){
LGRECT newsize;
gw->browser->reformat_pending = false;
browser_get_rect(gw, BR_CONTENT, &newsize);
/* this call will also schedule an redraw for the complete */
/* area. */
/* Resize must be handled here, because otherwise */
/* a redraw is scheduled twice (1. by the frontend, 2. by AES) */
browser_window_reformat(b->bw, false, newsize.g_w, newsize.g_h );
} else {
browser_schedule_redraw( gw, lclip.g_x, lclip.g_y,
lclip.g_x + lclip.g_w, lclip.g_y + lclip.g_h
);
}
);
}
}
return;

View File

@ -33,8 +33,8 @@
#include "desktop/history_core.h"
#include "desktop/netsurf.h"
#include "desktop/browser.h"
#include "desktop/mouse.h"
#include "desktop/plot_style.h"
#include "desktop/mouse.h"
#include "desktop/plot_style.h"
#include "desktop/plotters.h"
#include "atari/clipboard.h"
#include "atari/gui.h"
@ -44,25 +44,25 @@
#include "atari/clipboard.h"
#include "atari/misc.h"
#include "atari/global_evnt.h"
#include "atari/plot.h"
#include "atari/plot.h"
#include "cflib.h"
#include "atari/res/netsurf.rsh"
#include "atari/plot/plotter.h"
#include "atari/plot/plotter.h"
extern char * cfg_homepage_url;
extern short vdih;
extern void * h_gem_rsrc;
extern GEM_PLOTTER plotter;
static OBJECT * throbber_form = NULL;
static const plot_font_style_t font_style_url = {
.family = PLOT_FONT_FAMILY_SANS_SERIF,
.size = TOOLBAR_URL_TEXT_SIZE_PT*FONT_SIZE_SCALE,
.weight = 400,
.flags = FONTF_NONE,
.background = 0xffffff,
.foreground = 0x0
extern void * h_gem_rsrc;
extern GEM_PLOTTER plotter;
static OBJECT * throbber_form = NULL;
static const plot_font_style_t font_style_url = {
.family = PLOT_FONT_FAMILY_SANS_SERIF,
.size = TOOLBAR_URL_TEXT_SIZE_PT*FONT_SIZE_SCALE,
.weight = 400,
.flags = FONTF_NONE,
.background = 0xffffff,
.foreground = 0x0
};
/* prototypes & order for button widgets: */
@ -74,24 +74,24 @@ static struct s_tb_button tb_buttons[] =
{ TOOLBAR_BT_RELOAD, tb_reload_click, NULL },
{ TOOLBAR_BT_STOP, tb_stop_click, NULL },
{ 0, NULL, NULL }
};
};
static void tb_txt_request_redraw(void *data, int x, int y, int w, int h);
static void __CDECL button_redraw( COMPONENT *c, long buff[8])
{
OBJECT *tree = (OBJECT*)mt_CompDataSearch( &app, c, CDT_OBJECT );
struct gui_window * gw = mt_CompDataSearch( &app, c, CDT_OWNER );
LGRECT work,clip;
LGRECT work,clip;
GRECT todo,crect;
short pxy[4];
mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
clip = work;
clip = work;
/* return if component and redraw region does not intersect: */
if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) {
return;
}
}
/* clip contains intersecting part: */
pxy[0] = clip.g_x;
pxy[1] = clip.g_y;
@ -112,23 +112,23 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8])
pxy[3] = MIN( (short)buff[5] + buff[7], work.g_y + work.g_h - 2);
vswr_mode( vdih, MD_REPLACE);
v_bar( vdih, (short*)&pxy );
/* go through the rectangle list, using classic AES methods. */
/* Windom ComGetLGrect is buggy for WF_FIRST/NEXTXYWH */
crect.g_x = clip.g_x;
crect.g_y = clip.g_y;
crect.g_w = clip.g_w;
crect.g_h = clip.g_h;
/* go through the rectangle list, using classic AES methods. */
/* Windom ComGetLGrect is buggy for WF_FIRST/NEXTXYWH */
crect.g_x = clip.g_x;
crect.g_y = clip.g_y;
crect.g_w = clip.g_w;
crect.g_h = clip.g_h;
wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
&todo.g_x, &todo.g_y, &todo.g_w, &todo.g_h );
while( (todo.g_w > 0) && (todo.g_h > 0) ){
if( rc_intersect(&crect, &todo) ){
objc_draw( tree, 0, 0, todo.g_x, todo.g_y, todo.g_w, todo.g_h );
}
&todo.g_x, &todo.g_y, &todo.g_w, &todo.g_h );
while( (todo.g_w > 0) && (todo.g_h > 0) ){
if( rc_intersect(&crect, &todo) ){
objc_draw( tree, 0, 0, todo.g_x, todo.g_y, todo.g_w, todo.g_h );
}
wind_get(gw->root->handle->handle, WF_NEXTXYWH,
&todo.g_x, &todo.g_y, &todo.g_w, &todo.g_h );
}
&todo.g_x, &todo.g_y, &todo.g_w, &todo.g_h );
}
if( gw->root->toolbar->buttons[0].comp == c && work.g_x == buff[4] ){
vsl_color( vdih, LWHITE );
@ -231,67 +231,67 @@ void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
static
void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8] )
{
{
LGRECT work, clip;
struct gui_window * gw;
struct gui_window * gw;
short pxy[10];
gw = (struct gui_window *)mt_CompDataSearch(&app, c, CDT_OWNER);
gw = (struct gui_window *)mt_CompDataSearch(&app, c, CDT_OWNER);
if( gw == NULL )
return;
CMP_TOOLBAR tb = gw->root->toolbar;
mt_CompGetLGrect(&app, tb->url.comp, WF_WORKXYWH, &work);
// this last pixel is drawn by the root component of the toolbar:
// it's the black border, so we leave it out:
CMP_TOOLBAR tb = gw->root->toolbar;
mt_CompGetLGrect(&app, tb->url.comp, WF_WORKXYWH, &work);
// this last pixel is drawn by the root component of the toolbar:
// it's the black border, so we leave it out:
work.g_h--;
clip = work;
if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
pxy[0] = clip.g_x;
pxy[1] = clip.g_y;
pxy[2] = clip.g_w + clip.g_x-1;
pxy[2] = clip.g_w + clip.g_x-1;
pxy[3] = clip.g_h + clip.g_y-1;
vs_clip( vdih, 1, (short*)&pxy );
vs_clip( vdih, 1, (short*)&pxy );
vsf_perimeter( vdih, 0 );
vsf_interior( vdih , 1 );
vsf_color( vdih, LWHITE );
//left margin:
vsf_color( vdih, LWHITE );
//left margin:
pxy[0] = work.g_x;
pxy[1] = work.g_y;
pxy[2] = work.g_x + TOOLBAR_URL_MARGIN_LEFT-1;
pxy[3] = work.g_y + work.g_h-1;
v_bar( vdih, pxy );
// right margin:
pxy[3] = work.g_y + work.g_h-1;
v_bar( vdih, pxy );
// right margin:
pxy[0] = work.g_x+work.g_w-TOOLBAR_URL_MARGIN_RIGHT;
pxy[1] = work.g_y;
pxy[2] = work.g_x+work.g_w-1;
pxy[3] = work.g_y+work.g_h-1;
v_bar( vdih, pxy );
// top margin:
pxy[3] = work.g_y+work.g_h-1;
v_bar( vdih, pxy );
// top margin:
pxy[0] = work.g_x;
pxy[1] = work.g_y;
pxy[2] = work.g_x+work.g_w-1;
pxy[3] = work.g_y+TOOLBAR_URL_MARGIN_TOP-1;
v_bar( vdih, pxy );
// bottom margin:
pxy[3] = work.g_y+TOOLBAR_URL_MARGIN_TOP-1;
v_bar( vdih, pxy );
// bottom margin:
pxy[0] = work.g_x;
pxy[1] = work.g_y+work.g_h-TOOLBAR_URL_MARGIN_BOTTOM;
pxy[2] = work.g_x+work.g_w-1;
pxy[3] = work.g_y+work.g_h-1;
v_bar( vdih, pxy );
vs_clip( vdih, 0, (short*)&pxy );
// TBD: request redraw of textarea for specific region.
clip.g_x -= work.g_x+TOOLBAR_URL_MARGIN_LEFT;
clip.g_y -= work.g_y+TOOLBAR_URL_MARGIN_TOP;
tb_txt_request_redraw( tb, clip.g_x, clip.g_y, clip.g_w, clip.g_h );
pxy[3] = work.g_y+work.g_h-1;
v_bar( vdih, pxy );
vs_clip( vdih, 0, (short*)&pxy );
// TBD: request redraw of textarea for specific region.
clip.g_x -= work.g_x+TOOLBAR_URL_MARGIN_LEFT;
clip.g_y -= work.g_y+TOOLBAR_URL_MARGIN_TOP;
tb_txt_request_redraw( tb, clip.g_x, clip.g_y, clip.g_w, clip.g_h );
}
static
@ -312,34 +312,34 @@ void __CDECL evnt_url_click( COMPONENT *c, long buff[8] )
/* TODO: reset mouse state of browser window? */
/* select whole text when newly focused, otherwise set caret to end of text */
if( !window_url_widget_has_focus(gw) ) {
window_set_focus( gw, URL_WIDGET, (void*)&tb->url );
window_set_focus( gw, URL_WIDGET, (void*)&tb->url );
} else {
if( mb & 1 ) {
textarea_mouse_action( tb->url.textarea, BROWSER_MOUSE_DRAG_1,
mx, my );
short prev_x = mx;
short prev_y = my;
do{
if( abs(prev_x-mx) > 5 || abs(prev_y-my) > 5 ){
textarea_mouse_action( tb->url.textarea,
BROWSER_MOUSE_HOLDING_1, mx, my );
prev_x = mx;
prev_y = my;
if( tb->url.redraw ){
tb_url_redraw( gw );
}
}
graf_mkstate( &mx, &my, &mb, &kstat );
textarea_mouse_action( tb->url.textarea, BROWSER_MOUSE_DRAG_1,
mx, my );
short prev_x = mx;
short prev_y = my;
do{
if( abs(prev_x-mx) > 5 || abs(prev_y-my) > 5 ){
textarea_mouse_action( tb->url.textarea,
BROWSER_MOUSE_HOLDING_1, mx, my );
prev_x = mx;
prev_y = my;
if( tb->url.redraw ){
tb_url_redraw( gw );
}
}
graf_mkstate( &mx, &my, &mb, &kstat );
mx = mx - (work.g_x + TOOLBAR_URL_MARGIN_LEFT);
my = my - (work.g_y + TOOLBAR_URL_MARGIN_TOP);
}while( mb & 1 );
textarea_drag_end( tb->url.textarea, 0, mx, my );
my = my - (work.g_y + TOOLBAR_URL_MARGIN_TOP);
}while( mb & 1 );
textarea_drag_end( tb->url.textarea, 0, mx, my );
} else {
/* TODO: recognize click + shift key */
int mstate = BROWSER_MOUSE_PRESS_1;
if( (kstat & (K_LSHIFT|K_RSHIFT)) != 0 )
/* TODO: recognize click + shift key */
int mstate = BROWSER_MOUSE_PRESS_1;
if( (kstat & (K_LSHIFT|K_RSHIFT)) != 0 )
mstate = BROWSER_MOUSE_MOD_1;
textarea_mouse_action( tb->url.textarea,
textarea_mouse_action( tb->url.textarea,
BROWSER_MOUSE_PRESS_1, mx, my );
}
}
@ -347,21 +347,21 @@ void __CDECL evnt_url_click( COMPONENT *c, long buff[8] )
ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
work.g_x, work.g_y, work.g_w, work.g_h );
}
void tb_adjust_size( struct gui_window * gw )
{
LGRECT work;
CMP_TOOLBAR t = gw->root->toolbar;
mt_CompGetLGrect( &app, t->url.comp, WF_WORKXYWH, &work);
work.g_w -= (TOOLBAR_URL_MARGIN_LEFT + TOOLBAR_URL_MARGIN_RIGHT);
/* do not overwrite the black border, because of that, add 1 */
work.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM+1);
textarea_set_dimensions( t->url.textarea, work.g_w, work.g_h );
tb_txt_request_redraw( t, 0,0, work.g_w-1, work.g_h-1);
}
void tb_adjust_size( struct gui_window * gw )
{
LGRECT work;
CMP_TOOLBAR t = gw->root->toolbar;
mt_CompGetLGrect( &app, t->url.comp, WF_WORKXYWH, &work);
work.g_w -= (TOOLBAR_URL_MARGIN_LEFT + TOOLBAR_URL_MARGIN_RIGHT);
/* do not overwrite the black border, because of that, add 1 */
work.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM+1);
textarea_set_dimensions( t->url.textarea, work.g_w, work.g_h );
tb_txt_request_redraw( t, 0,0, work.g_w-1, work.g_h-1);
}
static void __CDECL evnt_toolbar_redraw( COMPONENT *c, long buff[8], void *data )
{
LGRECT work, clip;
@ -381,15 +381,15 @@ static void __CDECL evnt_toolbar_redraw( COMPONENT *c, long buff[8], void *data
pxy[1] = pxy[3] = work.g_y + work.g_h-1 ;
pxy[2] = clip.g_x + clip.g_w;
v_pline( vdih, 2, (short*)&pxy );
}
static void tb_txt_request_redraw(void *data, int x, int y, int w, int h)
{
LGRECT work;
if( data == NULL )
return;
CMP_TOOLBAR t = data;
}
static void tb_txt_request_redraw(void *data, int x, int y, int w, int h)
{
LGRECT work;
if( data == NULL )
return;
CMP_TOOLBAR t = data;
if( t->url.redraw == false ){
t->url.redraw = true;
t->url.rdw_area.g_x = x;
@ -404,41 +404,42 @@ static void tb_txt_request_redraw(void *data, int x, int y, int w, int h)
int oldy1 = t->url.rdw_area.g_y + t->url.rdw_area.g_h;
t->url.rdw_area.g_x = MIN(t->url.rdw_area.g_x, x);
t->url.rdw_area.g_y = MIN(t->url.rdw_area.g_y, y);
t->url.rdw_area.g_w = ( oldx1 > newx1 ) ?
t->url.rdw_area.g_w = ( oldx1 > newx1 ) ?
oldx1 - t->url.rdw_area.g_x : newx1 - t->url.rdw_area.g_x;
t->url.rdw_area.g_h = ( oldy1 > newy1 ) ?
t->url.rdw_area.g_h = ( oldy1 > newy1 ) ?
oldy1 - t->url.rdw_area.g_y : newy1 - t->url.rdw_area.g_y;
}
}
void tb_url_redraw( struct gui_window * gw )
{
CMP_TOOLBAR t = gw->root->toolbar;
}
}
void tb_url_redraw( struct gui_window * gw )
{
CMP_TOOLBAR t = gw->root->toolbar;
if (t != NULL) {
if( t->url.redraw && ((plotter->flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
const struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &atari_plotters
};
short todo[4];
LGRECT work;
LGRECT work;
mt_CompGetLGrect(&app, gw->root->toolbar->url.comp, WF_WORKXYWH, &work);
work.g_x += TOOLBAR_URL_MARGIN_RIGHT;
work.g_y += TOOLBAR_URL_MARGIN_LEFT;
work.g_w -= TOOLBAR_URL_MARGIN_RIGHT;
work.g_h -= TOOLBAR_URL_MARGIN_BOTTOM;
work.g_x += TOOLBAR_URL_MARGIN_RIGHT;
work.g_y += TOOLBAR_URL_MARGIN_LEFT;
work.g_w -= TOOLBAR_URL_MARGIN_RIGHT;
work.g_h -= TOOLBAR_URL_MARGIN_BOTTOM;
plotter->resize(plotter, work.g_w, work.g_h );
plotter->move(plotter, work.g_x, work.g_y );
if( plotter->lock( plotter ) == 0 )
plotter->move(plotter, work.g_x, work.g_y );
if( plotter->lock( plotter ) == 0 )
return;
todo[0] = work.g_x;
todo[1] = work.g_y;
todo[2] = todo[0] + work.g_w-1;
todo[3] = todo[1] + work.g_h-1;
todo[3] = todo[1] + work.g_h-1;
vs_clip(plotter->vdi_handle, 1, (short*)&todo );
if( wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
@ -457,12 +458,12 @@ void tb_url_redraw( struct gui_window * gw )
todo[1] = 0;
}
if (rc_intersect(&t->url.rdw_area,(GRECT *)&todo)) {
struct rect clip = {
.x0 = todo[0],
.y0 = todo[1],
.x1 = todo[0]+todo[2],
.y1 = todo[1]+todo[3]
if (rc_intersect(&t->url.rdw_area,(GRECT *)&todo)) {
struct rect clip = {
.x0 = todo[0],
.y0 = todo[1],
.x1 = todo[0]+todo[2],
.y1 = todo[1]+todo[3]
};
textarea_redraw( t->url.textarea, 0, 0, &clip, &ctx );
}
@ -471,10 +472,10 @@ void tb_url_redraw( struct gui_window * gw )
break;
}
}
} else {
} else {
plotter->unlock( plotter );
return;
}
}
plotter->unlock( plotter );
vs_clip(plotter->vdi_handle, 0, (short*)&todo);
t->url.redraw = false;
@ -485,9 +486,9 @@ void tb_url_redraw( struct gui_window * gw )
} else {
/* just copy stuff from the offscreen buffer */
}
}
}
}
CMP_TOOLBAR tb_create( struct gui_window * gw )
{
int i;
@ -497,7 +498,7 @@ CMP_TOOLBAR tb_create( struct gui_window * gw )
if( t == NULL )
return( NULL );
t->owner = gw;
t->owner = gw;
/* create the root component: */
t->comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, TOOLBAR_HEIGHT, 0);
@ -528,12 +529,12 @@ CMP_TOOLBAR tb_create( struct gui_window * gw )
}
/* create the url widget: */
t->url.textarea = textarea_create( 300, TOOLBAR_TEXTAREA_HEIGHT, 0,
&font_style_url, tb_txt_request_redraw,
t );
if( t->url.textarea != NULL ){
textarea_set_text(t->url.textarea, "http://");
}
t->url.textarea = textarea_create( 300, TOOLBAR_TEXTAREA_HEIGHT, 0,
&font_style_url, tb_txt_request_redraw,
t );
if( t->url.textarea != NULL ){
textarea_set_text(t->url.textarea, "http://");
}
t->url.comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, TOOLBAR_HEIGHT, 1);
mt_CompEvntAttach( &app, t->url.comp, WM_REDRAW, evnt_url_redraw );
@ -570,7 +571,7 @@ void tb_destroy( CMP_TOOLBAR tb )
mt_ObjcFree( &app, (OBJECT*)mt_CompDataSearch(&app, tb->buttons[i].comp, CDT_OBJECT) );
i++;
}
free( tb->buttons );
free( tb->buttons );
textarea_destroy( tb->url.textarea );
mt_CompDelete( &app, tb->comp);
free( tb );
@ -646,20 +647,20 @@ void tb_url_set( struct gui_window * gw, char * text )
if( gw->browser->attached == false )
return;
struct s_url_widget * url = &gw->root->toolbar->url;
struct s_url_widget * url = &gw->root->toolbar->url;
assert( gw != NULL );
assert( gw->browser != NULL );
assert( gw->root != NULL );
assert( gw->browser->bw != NULL );
textarea_set_text(url->textarea, text);
mt_CompGetLGrect( &app, gw->root->toolbar->url.comp, WF_WORKXYWH, &work);
work.g_w -= (TOOLBAR_URL_MARGIN_LEFT + TOOLBAR_URL_MARGIN_RIGHT);
/* do not overwrite the black border, because of that, add 1 */
work.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM+1);
tb_txt_request_redraw( gw->root->toolbar, 0,0,work.g_w,work.g_h );
assert( gw->browser->bw != NULL );
textarea_set_text(url->textarea, text);
mt_CompGetLGrect( &app, gw->root->toolbar->url.comp, WF_WORKXYWH, &work);
work.g_w -= (TOOLBAR_URL_MARGIN_LEFT + TOOLBAR_URL_MARGIN_RIGHT);
/* do not overwrite the black border, because of that, add 1 */
work.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM+1);
tb_txt_request_redraw( gw->root->toolbar, 0,0,work.g_w,work.g_h );
return;
}
@ -673,41 +674,41 @@ bool tb_url_input( struct gui_window * gw, short nkc )
CMP_TOOLBAR tb = gw->root->toolbar;
assert(tb!=NULL);
LGRECT work;
bool ret = false;
bool ret = false;
assert( gw != NULL );
long ucs4;
long ik = nkc_to_input_key( nkc, &ucs4 );
if( ik == 0 ){
assert( gw != NULL );
long ucs4;
long ik = nkc_to_input_key( nkc, &ucs4 );
if( ik == 0 ){
if ( (nkc&0xFF) >= 9 ) {
ret = textarea_keypress( tb->url.textarea, ucs4 );
}
}
else if( ik == KEY_CR || ik == KEY_NL ){
char tmp_url[PATH_MAX];
if( textarea_get_text( tb->url.textarea, tmp_url, PATH_MAX) > 0 ) {
}
}
else if( ik == KEY_CR || ik == KEY_NL ){
char tmp_url[PATH_MAX];
if( textarea_get_text( tb->url.textarea, tmp_url, PATH_MAX) > 0 ) {
window_set_focus( gw, BROWSER, gw->browser);
browser_window_go(gw->browser->bw, (const char*)&tmp_url, 0, true);
ret = true;
}
}
else if( ik == KEY_COPY_SELECTION ){
// copy whole text
char * text;
int len;
len = textarea_get_text( tb->url.textarea, NULL, 0 );
text = malloc( len+1 );
if( text ){
textarea_get_text( tb->url.textarea, text, len+1 );
scrap_txt_write( &app, text );
free( text );
}
}
else {
ret = textarea_keypress( tb->url.textarea, ik );
}
browser_window_go(gw->browser->bw, (const char*)&tmp_url, 0, true);
ret = true;
}
}
else if( ik == KEY_COPY_SELECTION ){
// copy whole text
char * text;
int len;
len = textarea_get_text( tb->url.textarea, NULL, 0 );
text = malloc( len+1 );
if( text ){
textarea_get_text( tb->url.textarea, text, len+1 );
scrap_txt_write( &app, text );
free( text );
}
}
else {
ret = textarea_keypress( tb->url.textarea, ik );
}
return( ret );
}

View File

@ -61,25 +61,25 @@ static void __CDECL evnt_tv_keybd( WINDOW *win, short buff[8], void * data )
bool r=false;
long kstate = 0;
long kcode = 0;
long ucs4;
long ik;
long ucs4;
long ik;
unsigned short nkc = 0;
unsigned short nks = 0;
unsigned char ascii;
NSTREEVIEW tv = (NSTREEVIEW) data;
NSTREEVIEW tv = (NSTREEVIEW) data;
kstate = evnt.mkstate;
kcode = evnt.keybd;
nkc= gem_to_norm( (short)kstate, (short)kcode );
nkc= gem_to_norm( (short)kstate, (short)kcode );
ascii = (nkc & 0xFF);
ik = nkc_to_input_key( nkc, &ucs4 );
if( ik == 0 ){
ik = nkc_to_input_key( nkc, &ucs4 );
if( ik == 0 ){
if (ascii >= 9 ) {
r = tree_keypress( tv->tree, ucs4 );
}
} else {
r = tree_keypress( tv->tree, ik );
}
} else {
r = tree_keypress( tv->tree, ik );
}
}
@ -104,16 +104,16 @@ static void __CDECL evnt_tv_redraw( WINDOW *win, short buff[8], void * data )
clip.g_y = 0;
}
if( clip.g_h > 0 && clip.g_w > 0 ) {
atari_treeview_request_redraw(
win->xpos*win->w_u + clip.g_x,
atari_treeview_request_redraw(
win->xpos*win->w_u + clip.g_x,
win->ypos*win->h_u + clip.g_y,
clip.g_w, clip.g_h, tv
clip.g_w, clip.g_h, tv
);
}
}
static void __CDECL evnt_tv_mbutton( WINDOW *win, short buff[8], void * data )
{
static void __CDECL evnt_tv_mbutton( WINDOW *win, short buff[8], void * data )
{
GRECT work;
NSTREEVIEW tv = (NSTREEVIEW) data;
if( tv == NULL )
@ -121,81 +121,81 @@ static void __CDECL evnt_tv_mbutton( WINDOW *win, short buff[8], void * data )
if( evnt.mbut & 2 ) {
/* do not handle right click */
return;
}
WindGetGrect( tv->window, WF_WORKXYWH, &work );
}
WindGetGrect( tv->window, WF_WORKXYWH, &work );
/* mouse click relative origin: */
short origin_rel_x = (evnt.mx-work.g_x)+(win->xpos*win->w_u);
short origin_rel_y = (evnt.my-work.g_y)+(win->ypos*win->h_u);
if( origin_rel_x >= 0 && origin_rel_y >= 0
&& evnt.mx < work.g_x + work.g_w
&& evnt.my < work.g_y + work.g_h )
{
int bms;
bool ignore=false;
short cur_rel_x, cur_rel_y, dummy, mbut;
if( evnt.nb_click == 2 ){
tree_mouse_action(tv->tree,
BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_DOUBLE_CLICK,
origin_rel_x, origin_rel_y );
return;
}
graf_mkstate(&cur_rel_x, &cur_rel_x, &mbut, &dummy);
if( (mbut&1) == 0 ){
bms = BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1;
if( evnt.nb_click == 2 ) {
bms = BROWSER_MOUSE_DOUBLE_CLICK;
}
tree_mouse_action(tv->tree, bms, origin_rel_x, origin_rel_y );
} else {
/* button still pressed */
short prev_x = origin_rel_x;
short prev_y = origin_rel_y;
cur_rel_x = origin_rel_x;
cur_rel_y = origin_rel_y;
if( tree_is_edited(tv->tree) ){
gem_set_cursor(&gem_cursors.ibeam);
} else {
gem_set_cursor(&gem_cursors.hand);
}
tv->startdrag.x = origin_rel_x;
tv->startdrag.y = origin_rel_y;
tree_mouse_action( tv->tree,
BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON ,
cur_rel_x, cur_rel_y );
do{
if( abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5 ){
tree_mouse_action( tv->tree,
BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
cur_rel_x, cur_rel_y);
prev_x = cur_rel_x;
prev_y = cur_rel_y;
}
if( tv->redraw )
atari_treeview_redraw( tv );
/* sample mouse button state: */
graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy);
cur_rel_x = (cur_rel_x-work.g_x)+(win->xpos*win->w_u);
cur_rel_y = (cur_rel_y-work.g_y)+(win->ypos*win->h_u);
} while( mbut & 1 );
short origin_rel_y = (evnt.my-work.g_y)+(win->ypos*win->h_u);
if( origin_rel_x >= 0 && origin_rel_y >= 0
&& evnt.mx < work.g_x + work.g_w
&& evnt.my < work.g_y + work.g_h )
{
int bms;
bool ignore=false;
short cur_rel_x, cur_rel_y, dummy, mbut;
if( evnt.nb_click == 2 ){
tree_mouse_action(tv->tree,
BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_DOUBLE_CLICK,
origin_rel_x, origin_rel_y );
return;
}
graf_mkstate(&cur_rel_x, &cur_rel_x, &mbut, &dummy);
if( (mbut&1) == 0 ){
bms = BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1;
if( evnt.nb_click == 2 ) {
bms = BROWSER_MOUSE_DOUBLE_CLICK;
}
tree_mouse_action(tv->tree, bms, origin_rel_x, origin_rel_y );
} else {
/* button still pressed */
short prev_x = origin_rel_x;
short prev_y = origin_rel_y;
cur_rel_x = origin_rel_x;
cur_rel_y = origin_rel_y;
if( tree_is_edited(tv->tree) ){
gem_set_cursor(&gem_cursors.ibeam);
} else {
gem_set_cursor(&gem_cursors.hand);
}
tv->startdrag.x = origin_rel_x;
tv->startdrag.y = origin_rel_y;
tree_mouse_action( tv->tree,
BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON ,
cur_rel_x, cur_rel_y );
do{
if( abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5 ){
tree_mouse_action( tv->tree,
BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
cur_rel_x, cur_rel_y);
prev_x = cur_rel_x;
prev_y = cur_rel_y;
}
if( tv->redraw )
atari_treeview_redraw( tv );
/* sample mouse button state: */
graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy);
cur_rel_x = (cur_rel_x-work.g_x)+(win->xpos*win->w_u);
cur_rel_y = (cur_rel_y-work.g_y)+(win->ypos*win->h_u);
} while( mbut & 1 );
tree_drag_end(tv->tree, 0, tv->startdrag.x, tv->startdrag.y,
cur_rel_x, cur_rel_y );
gem_set_cursor(&gem_cursors.arrow);
}
}
}
tree_drag_end(tv->tree, 0, tv->startdrag.x, tv->startdrag.y,
cur_rel_x, cur_rel_y );
gem_set_cursor(&gem_cursors.arrow);
}
}
}
NSTREEVIEW atari_treeview_create( uint32_t flags, WINDOW *win )
{
if( win == NULL )
@ -274,12 +274,13 @@ void atari_treeview_redraw( NSTREEVIEW tv)
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &atari_plotters
};
plotter->resize(plotter, work.g_w, work.g_h);
plotter->move(plotter, work.g_x, work.g_y );
if( plotter->lock( plotter ) == 0 )
plotter->move(plotter, work.g_x, work.g_y );
if( plotter->lock( plotter ) == 0 )
return;
todo[0] = work.g_x;
@ -314,10 +315,10 @@ void atari_treeview_redraw( NSTREEVIEW tv)
break;
}
}
} else {
} else {
plotter->unlock( plotter );
return;
}
}
plotter->unlock( plotter );
vs_clip(plotter->vdi_handle, 0, (short*)&todo);
tv->redraw = false;

View File

@ -1387,6 +1387,7 @@ gboolean nsbeos_history_expose_event(beosWidget *widget,
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &nsbeos_plotters
};

View File

@ -73,6 +73,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
struct redraw_context ctx;
ctx.interactive = false;
ctx.background_images = true;
ctx.plot = &nsbeos_plotters;
assert(content);

View File

@ -783,7 +783,7 @@ void nsbeos_window_expose_event(BView *view, gui_window *g, BMessage *message)
float scale = g->bw->scale;
struct rect clip;
struct redraw_context ctx = { true, &nsbeos_plotters };
struct redraw_context ctx = { true, true, &nsbeos_plotters };
assert(g);
assert(g->bw);

View File

@ -148,6 +148,7 @@ static inline NSRect cocoa_get_caret_rect( BrowserView *view )
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &cocoa_plotters
};

View File

@ -59,6 +59,7 @@
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &cocoa_plotters
};

View File

@ -127,6 +127,7 @@ static void tree_get_window_dimensions( int *width, int *height, void *data )
{
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &cocoa_plotters
};

View File

@ -34,6 +34,7 @@ bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap,
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &cocoa_plotters
};

View File

@ -304,6 +304,7 @@ fb_redraw(fbtk_widget_t *widget,
struct rect clip;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &fb_plotters
};

View File

@ -62,6 +62,7 @@ localhistory_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &fb_plotters
};

View File

@ -43,6 +43,7 @@ thumbnail_create(struct hlcache_handle *content,
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &fb_plotters
};

View File

@ -1512,6 +1512,7 @@ static gboolean nsgtk_history_expose_event(GtkWidget *widget,
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &nsgtk_plotters
};

View File

@ -63,6 +63,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &nsgtk_plotters
};

View File

@ -171,6 +171,7 @@ gboolean nsgtk_tree_window_expose_event(GtkWidget *widget,
struct tree *tree = (struct tree *) g;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &nsgtk_plotters
};
int x, y, width, height;

View File

@ -145,6 +145,7 @@ static gboolean nsgtk_window_expose_event(GtkWidget *widget,
struct rect clip;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &nsgtk_plotters
};

View File

@ -449,6 +449,7 @@ monkey_window_handle_redraw(int argc, char **argv)
struct rect clip;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &monkey_plotters
};

View File

@ -584,6 +584,7 @@ void ro_gui_url_bar_redraw(struct url_bar *url_bar, wimp_draw *redraw)
struct content_redraw_data data;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &ro_plotters
};

View File

@ -141,6 +141,7 @@ void ro_gui_history_redraw(wimp_draw *redraw)
os_error *error;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &ro_plotters
};

View File

@ -686,6 +686,7 @@ bool print_document(struct gui_window *g, const char *filename)
/* TODO: turn knockout off for print */
struct redraw_context ctx = {
.interactive = false,
.background_images = false,
.plot = &ro_plotters
};
@ -806,6 +807,7 @@ const char *print_declare_fonts(hlcache_handle *h)
os_error *error;
struct redraw_context ctx = {
.interactive = false,
.background_images = false,
.plot = &print_fonts_plotters
};

View File

@ -95,6 +95,7 @@ bool save_as_draw(hlcache_handle *h, const char *path)
os_error *error;
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &ro_save_draw_plotters
};

View File

@ -88,6 +88,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
_kernel_oserror *error;
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &ro_plotters
};

View File

@ -445,6 +445,7 @@ void ro_treeview_redraw_loop(wimp_draw *redraw, ro_treeview *tv, osbool more)
os_error *error;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &ro_plotters
};

View File

@ -1419,6 +1419,7 @@ void ro_gui_window_redraw(wimp_draw *redraw)
os_error *error;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &ro_plotters
};
@ -4097,6 +4098,7 @@ void ro_gui_window_update_boxes(void)
struct gui_window *g;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &ro_plotters
};

View File

@ -39,6 +39,9 @@ struct redraw_context {
* etc. Should be off for printing. */
bool interactive;
/** Render background images. May want it off for printing. */
bool background_images;
/** Current plotters, must be assigned before use. */
const struct plotter_table *plot;
};

View File

@ -307,6 +307,7 @@ nsws_drawable_paint(struct gui_window *gw, HWND hwnd)
PAINTSTRUCT ps;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &win_plotters
};

View File

@ -81,6 +81,7 @@ static void nsws_localhistory_up(struct nsws_localhistory *l, struct gui_window
HDC tmp_hdc;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &win_plotters
};
@ -274,6 +275,7 @@ nsws_localhistory_event_callback(HWND hwnd, UINT msg,
HDC hdc, tmp_hdc;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &win_plotters
};

View File

@ -40,6 +40,7 @@ thumbnail_create(hlcache_handle *content,
HDC hdc, bufferdc, minidc;
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &win_plotters
};