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; int posx, posy;
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = true, .interactive = true,
.background_images = true,
.plot = &amiplot .plot = &amiplot
}; };
@ -3373,6 +3374,7 @@ void ami_do_redraw(struct gui_window_2 *g)
struct rect clip; struct rect clip;
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = true, .interactive = true,
.background_images = true,
.plot = &amiplot .plot = &amiplot
}; };

View File

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

View File

@ -44,6 +44,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
int plot_height; int plot_height;
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = false, .interactive = false,
.background_images = true,
.plot = &amiplot .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; int pos_x, pos_y;
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = true, .interactive = true,
.background_images = true,
.plot = &amiplot .plot = &amiplot
}; };

View File

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

View File

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

View File

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

View File

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

View File

@ -73,6 +73,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
struct redraw_context ctx; struct redraw_context ctx;
ctx.interactive = false; ctx.interactive = false;
ctx.background_images = true;
ctx.plot = &nsbeos_plotters; ctx.plot = &nsbeos_plotters;
assert(content); 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; float scale = g->bw->scale;
struct rect clip; struct rect clip;
struct redraw_context ctx = { true, &nsbeos_plotters }; struct redraw_context ctx = { true, true, &nsbeos_plotters };
assert(g); assert(g);
assert(g->bw); assert(g->bw);

View File

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

View File

@ -59,6 +59,7 @@
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = true, .interactive = true,
.background_images = true,
.plot = &cocoa_plotters .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 = { struct redraw_context ctx = {
.interactive = true, .interactive = true,
.background_images = true,
.plot = &cocoa_plotters .plot = &cocoa_plotters
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -449,6 +449,7 @@ monkey_window_handle_redraw(int argc, char **argv)
struct rect clip; struct rect clip;
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = true, .interactive = true,
.background_images = true,
.plot = &monkey_plotters .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 content_redraw_data data;
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = true, .interactive = true,
.background_images = true,
.plot = &ro_plotters .plot = &ro_plotters
}; };

View File

@ -141,6 +141,7 @@ void ro_gui_history_redraw(wimp_draw *redraw)
os_error *error; os_error *error;
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = true, .interactive = true,
.background_images = true,
.plot = &ro_plotters .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 */ /* TODO: turn knockout off for print */
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = false, .interactive = false,
.background_images = false,
.plot = &ro_plotters .plot = &ro_plotters
}; };
@ -806,6 +807,7 @@ const char *print_declare_fonts(hlcache_handle *h)
os_error *error; os_error *error;
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = false, .interactive = false,
.background_images = false,
.plot = &print_fonts_plotters .plot = &print_fonts_plotters
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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