From b18ede1a60fc07b1ac21268a98fb66873357217d Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sat, 22 Jan 2011 16:34:10 +0000 Subject: Limit length of statustext to 80 chars, to satisfy v_gtext specifications. Introduced attached flag. svn path=/trunk/netsurf/; revision=11444 --- atari/statusbar.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/atari/statusbar.c b/atari/statusbar.c index d0f3e8e12..bd8e2e7ad 100644 --- a/atari/statusbar.c +++ b/atari/statusbar.c @@ -45,33 +45,43 @@ #include "atari/plot/plotter.h" extern short vdih; +extern unsigned short gdosversion; static void __CDECL evnt_sb_redraw( COMPONENT *c, long buff[8] ) { struct gui_window * gw = (struct gui_window *)mt_CompDataSearch(&app, c, CDT_OWNER); + assert(gw != NULL); CMP_STATUSBAR sb = gw->root->statusbar; + assert( sb != NULL ); + if( sb == NULL ) + return; + + assert( sb->attached != false ); + if( sb->attached == false ) + return; + LGRECT work, lclip; short pxy[8], d, pxyclip[4]; mt_CompGetLGrect(&app, sb->comp, WF_WORKXYWH, &work); lclip = work; - if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) return; - + if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) { + return; + } vsf_interior( vdih, FIS_SOLID ); vsl_color( vdih, BLACK ); vsl_type( vdih, 1); vsl_width( vdih, 1 ); vst_color(vdih, BLACK); - vst_height( vdih, 10, &pxy[0], &pxy[1], &pxy[2], &pxy[3] ); - vst_arbpt( vdih, 9, &pxy[0], &pxy[1], &pxy[2], &pxy[3] ); + vst_point( vdih, 9, &pxy[0], &pxy[1], &pxy[2], &pxy[3] ); vst_alignment(vdih, 0, 5, &d, &d ); vst_effects( vdih, 0 ); - pxyclip[0] = lclip.g_x; pxyclip[1] = lclip.g_y; pxyclip[2] = lclip.g_x + lclip.g_w; pxyclip[3] = lclip.g_y + lclip.g_h; + vs_clip(vdih, 1, (short*)&pxyclip ); vswr_mode( vdih, MD_REPLACE ); @@ -83,16 +93,19 @@ void __CDECL evnt_sb_redraw( COMPONENT *c, long buff[8] ) v_pline( vdih, 2, (short*)&pxy ); } - vsf_color( vdih, LWHITE); + if(app.nplanes > 2) { + vsf_color( vdih, LWHITE); + } else { + vsf_color( vdih, WHITE ); + } + pxy[0] = work.g_x; pxy[1] = work.g_y+1; pxy[2] = work.g_x + work.g_w; pxy[3] = work.g_y + work.g_h-1; v_bar( vdih, pxy ); - vswr_mode( vdih, MD_TRANS ); v_gtext( vdih, work.g_x + 2, work.g_y + 5, (char*)&sb->text ); - vswr_mode( vdih, MD_REPLACE ); pxy[0] = work.g_x + work.g_w - MOVER_WH; @@ -108,7 +121,7 @@ void __CDECL evnt_sb_redraw( COMPONENT *c, long buff[8] ) v_pline( vdih, 2, (short*)&pxy ); vs_clip(vdih, 0, (short*)&pxyclip ); - + return; } static void __CDECL evnt_sb_click( COMPONENT *c, long buff[8] ) @@ -139,13 +152,14 @@ static void __CDECL evnt_sb_click( COMPONENT *c, long buff[8] ) CMP_STATUSBAR sb_create( struct gui_window * gw ) { CMP_STATUSBAR s = malloc( sizeof(struct s_statusbar) ); + s->attached = false; s->comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, STATUSBAR_HEIGHT, 0); s->comp->rect.g_h = STATUSBAR_HEIGHT; s->comp->bounds.max_height = STATUSBAR_HEIGHT; mt_CompDataAttach( &app, s->comp, CDT_OWNER, gw ); mt_CompEvntAttach( &app, s->comp, WM_REDRAW, evnt_sb_redraw ); mt_CompEvntAttach( &app, s->comp, WM_XBUTTON, evnt_sb_click ); - strncpy( (char*)&s->text, "  ", 254 ); + strncpy( (char*)&s->text, "  ", 80 ); return( s ); } @@ -162,7 +176,7 @@ void sb_destroy( CMP_STATUSBAR s ) void sb_set_text( struct gui_window * gw , char * text ) { - + assert( gw->root != NULL); if( gw->root == NULL ) return; CMP_STATUSBAR sb = gw->root->statusbar; @@ -171,8 +185,11 @@ void sb_set_text( struct gui_window * gw , char * text ) if( sb == NULL || gw->browser->attached == false ) return; - strncpy( (char*)&sb->text, text, 254 ); - mt_CompGetLGrect(&app, sb->comp, WF_WORKXYWH, &work); - ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle, - work.g_x, work.g_y, work.g_w, work.g_h ); + strncpy( (char*)&sb->text, text, 79 ); + sb->text[79]=0; + if( sb->attached ){ + mt_CompGetLGrect(&app, sb->comp, WF_WORKXYWH, &work); + ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle, + work.g_x, work.g_y, work.g_w, work.g_h ); + } } -- cgit v1.2.3