summaryrefslogtreecommitdiff
path: root/atari
diff options
context:
space:
mode:
Diffstat (limited to 'atari')
-rwxr-xr-xatari/browser.c10
-rwxr-xr-xatari/options.h6
-rwxr-xr-xatari/plot/plot.c3
-rwxr-xr-xatari/toolbar.c172
4 files changed, 94 insertions, 97 deletions
diff --git a/atari/browser.c b/atari/browser.c
index 373cd73c7..c8efe3dd0 100755
--- a/atari/browser.c
+++ b/atari/browser.c
@@ -695,9 +695,9 @@ void browser_redraw_caret( struct gui_window * gw, LGRECT * area )
/* 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 );
+ 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;
@@ -707,9 +707,9 @@ void browser_redraw_caret( struct gui_window * gw, LGRECT * area )
pxy[6] = caret.g_w - 1;
pxy[7] = caret.g_h - 1;
/* hide the mouse */
- v_hide_c ( app.graf.handle);
+ v_hide_c (app.graf.handle);
/* 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);
/* draw caret: */
caret.g_x -= area->g_x;
caret.g_y -= area->g_y;
diff --git a/atari/options.h b/atari/options.h
index 005271f62..3ec264628 100755
--- a/atari/options.h
+++ b/atari/options.h
@@ -30,7 +30,7 @@
int atari_dither; \
int atari_transparency; \
int atari_image_toolbar; \
- int atari_toolbar_bg; \
+ colour atari_toolbar_bg; \
char *atari_image_toolbar_folder; \
char *atari_face_sans_serif; /* default sans face */ \
char *atari_face_sans_serif_bold; /* bold sans face */ \
@@ -55,7 +55,7 @@
.atari_transparency = 1, \
.atari_image_toolbar_folder = (char*)"default", \
.atari_image_toolbar = 0, \
- .atari_toolbar_bg = 8, \
+ .atari_toolbar_bg = 0xFFFFFF, \
.atari_face_sans_serif = NULL, \
.atari_face_sans_serif_bold = NULL, \
.atari_face_sans_serif_italic = NULL, \
@@ -76,7 +76,7 @@
{ "atari_font_driver", OPTION_STRING, &nsoptions.atari_font_driver },\
{ "atari_font_monochrom", OPTION_INTEGER, &nsoptions.atari_font_monochrom },\
{ "atari_image_toolbar", OPTION_INTEGER, &nsoptions.atari_image_toolbar },\
- { "atari_toolbar_bg", OPTION_INTEGER, &nsoptions.atari_toolbar_bg },\
+ { "atari_toolbar_bg", OPTION_COLOUR, &nsoptions.atari_toolbar_bg },\
{ "atari_transparency", OPTION_INTEGER, &nsoptions.atari_transparency },\
{ "atari_dither", OPTION_INTEGER, &nsoptions.atari_dither },\
{ "atari_editor", OPTION_STRING, &nsoptions.atari_editor },\
diff --git a/atari/plot/plot.c b/atari/plot/plot.c
index 1d12ebab2..8499ac7a6 100755
--- a/atari/plot/plot.c
+++ b/atari/plot/plot.c
@@ -1846,6 +1846,7 @@ static bool plot_polygon(const int *p, unsigned int n,
bool plot_set_dimensions(int x, int y, int w, int h)
{
bool doupdate = false;
+ struct rect newclip = {0, 0, w, h};
if (!(w == view.w && h == view.h)) {
struct rect newclip = { 0, 0, w-1, h-1 };
@@ -1860,6 +1861,8 @@ bool plot_set_dimensions(int x, int y, int w, int h)
}
if (doupdate==true)
update_visible_rect();
+
+ plot_clip(&newclip);
return(true);
}
diff --git a/atari/toolbar.c b/atari/toolbar.c
index dd822ebc5..ab88a6b2e 100755
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -62,7 +62,7 @@ static OBJECT * toolbar_buttons = NULL;
static OBJECT * throbber_form = NULL;
static bool img_toolbar = false;
static char * toolbar_image_folder = (char *)"default";
-static short toolbar_bg_color = LWHITE;
+static uint32_t toolbar_bg_color = 0xFFFFFF;
static hlcache_handle * toolbar_image;
static hlcache_handle * throbber_image;
static bool toolbar_image_ready = false;
@@ -125,7 +125,6 @@ struct s_toolbar_style {
int icon_height;
int button_hmargin;
int button_vmargin;
- short bgcolor;
/* RRGGBBAA: */
uint32_t icon_bgcolor;
};
@@ -133,13 +132,13 @@ struct s_toolbar_style {
static struct s_toolbar_style toolbar_styles[] =
{
/* small (18 px height) */
- { 9, 18, 16, 16, 0, 0, LWHITE, 0 },
+ { 9, 18, 16, 16, 0, 0, 0 },
/* medium (default - 26 px height) */
- {14, 26, 24, 24, 1, 4, LWHITE, 0 },
+ {14, 26, 24, 24, 1, 4, 0 },
/* large ( 49 px height ) */
- {18, 34, 64, 64, 2, 0, LWHITE, 0 },
+ {18, 34, 64, 64, 2, 0, 0 },
/* custom style: */
- {18, 34, 64, 64, 2, 0, LWHITE, 0 }
+ {18, 34, 64, 64, 2, 0, 0 }
};
static void tb_txt_request_redraw( void *data, int x, int y, int w, int h );
@@ -154,7 +153,7 @@ void toolbar_init( void )
uint32_t rgbcolor;
toolbar_image_folder = nsoption_charp(atari_image_toolbar_folder);
- toolbar_bg_color = MIN(15,nsoption_int(atari_toolbar_bg));
+ toolbar_bg_color = (nsoption_colour(atari_toolbar_bg));
img_toolbar = (nsoption_int( atari_image_toolbar ) > 0 ) ? true : false;
if( img_toolbar ){
@@ -184,13 +183,8 @@ void toolbar_init( void )
throbber_form->ob_y = 0;
}
n = (sizeof( toolbar_styles ) / sizeof( struct s_toolbar_style ));
- for( i=0; i<n; i++ ){
- toolbar_styles[i].bgcolor = toolbar_bg_color;
- if( img_toolbar ){
- vq_color(atari_plot_vdi_handle, toolbar_bg_color, 0, vdicolor );
- vdi1000_to_rgb( vdicolor, (unsigned char*)&rgbcolor );
- toolbar_styles[i].icon_bgcolor = rgbcolor;
- }
+ for (i=0; i<n; i++) {
+ toolbar_styles[i].icon_bgcolor = ABGR_TO_RGB(toolbar_bg_color);
}
}
@@ -236,15 +230,22 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
short pxy[4];
int bmpx=0, bmpy=0, bmpw=0, bmph = 0, drawstate=0;
- struct rect icon_clip;
struct bitmap * icon = NULL;
+ struct rect icon_clip;
+ GRECT icon_dim = {0,0,0,0};
+ plot_style_t plot_style_background = {
+ .fill_type = PLOT_OP_TYPE_SOLID,
+ .fill_colour = toolbar_bg_color,
+ .stroke_type = PLOT_OP_TYPE_NONE
+ };
+
mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
work.g_h = work.g_h - 1;
clip = work;
/* return if component and redraw region does not intersect: */
- if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) {
+ if (!rc_lintersect( (LGRECT*)&buff[4], &clip)) {
return;
}
@@ -264,18 +265,14 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
bmph = bitmap_get_height(icon);
bmpx = 0;
bmpy = 0;
-
- plot_set_dimensions(
- work.g_x-(toolbar_styles[tb->style].icon_width * bt->index)+toolbar_styles[tb->style].button_vmargin,
- work.g_y-(toolbar_styles[tb->style].icon_height * drawstate)+toolbar_styles[tb->style].button_hmargin,
- toolbar_styles[tb->style].icon_width*(bt->index+1),
- toolbar_styles[tb->style].icon_height*(drawstate+1)
- );
icon_clip.x0 = bmpx+(toolbar_styles[tb->style].icon_width*bt->index);
icon_clip.y0 = bmpy+(toolbar_styles[tb->style].icon_height*drawstate);
icon_clip.x1 = icon_clip.x0+toolbar_styles[tb->style].icon_width;
icon_clip.y1 = icon_clip.y0+toolbar_styles[tb->style].icon_height;
- plot_clip( &icon_clip );
+ icon_dim.g_x = work.g_x-(toolbar_styles[tb->style].icon_width * bt->index)+toolbar_styles[tb->style].button_vmargin;
+ icon_dim.g_y = work.g_y-(toolbar_styles[tb->style].icon_height * drawstate)+toolbar_styles[tb->style].button_hmargin;
+ icon_dim.g_w = toolbar_styles[tb->style].icon_width*(bt->index+1);
+ icon_dim.g_h = toolbar_styles[tb->style].icon_height*(drawstate+1);
} else {
/* Place the CICON into workarea: */
tree = &toolbar_buttons[bt->rsc_id];
@@ -292,7 +289,6 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
/* Setup draw mode: */
vsf_interior(atari_plot_vdi_handle , 1 );
- vsf_color(atari_plot_vdi_handle, toolbar_styles[tb->style].bgcolor );
vswr_mode(atari_plot_vdi_handle, MD_REPLACE);
/* go through the rectangle list, using classic AES methods. */
@@ -305,15 +301,22 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
&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 ) ){
+ if (rc_intersect(&crect, &todo )) {
+
+ struct rect bgclip = {0,0,todo.g_w, todo.g_h};
pxy[0] = todo.g_x;
pxy[1] = todo.g_y;
pxy[2] = todo.g_w + todo.g_x-1;
pxy[3] = todo.g_h + todo.g_y-1;
+
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
- v_bar(atari_plot_vdi_handle, (short*)&pxy );
-
+ plot_set_dimensions(todo.g_x, todo.g_y, todo.g_w, todo.g_h);
+ plot_rectangle(0, 0, crect.g_w, crect.g_h, &plot_style_background);
+
if( img_toolbar == true ){
+ plot_set_dimensions(icon_dim.g_x, icon_dim.g_y,
+ icon_dim.g_w, icon_dim.g_h);
+ plot_clip( &icon_clip );
atari_plotters.bitmap( bmpx, bmpy, bmpw, bmph, icon,
toolbar_styles[tb->style].icon_bgcolor,
BITMAPF_BUFFER_NATIVE );
@@ -383,6 +386,11 @@ void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
struct gui_window * gw = (struct gui_window *)mt_CompDataSearch(&app,
c,
CDT_OWNER );
+ plot_style_t plot_style_background = {
+ .fill_type = PLOT_OP_TYPE_SOLID,
+ .fill_colour = toolbar_bg_color,
+ .stroke_type = PLOT_OP_TYPE_NONE
+ };
tb = gw->root->toolbar;
mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
@@ -390,16 +398,20 @@ void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
vsf_interior(atari_plot_vdi_handle , 1 );
- if(app.nplanes > 2 )
- vsf_color(atari_plot_vdi_handle, toolbar_styles[tb->style].bgcolor );
- else
- vsf_color(atari_plot_vdi_handle, WHITE );
pxy[0] = (short)buff[4];
pxy[1] = (short)buff[5];
pxy[2] = (short)buff[4] + buff[6]-1;
- pxy[3] = (short)buff[5] + buff[7]-2;
- v_bar(atari_plot_vdi_handle, (short*)&pxy );
- vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
+ pxy[3] = (short)buff[5] + buff[7]-2;
+ vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
+
+ if (app.nplanes > 2 ) {
+ plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
+ plot_rectangle( 0, 0, work.g_w, work.g_h, &plot_style_background);
+ }
+ else {
+ vsf_color(atari_plot_vdi_handle, WHITE );
+ v_bar(atari_plot_vdi_handle, (short*)&pxy );
+ }
if( img_toolbar ){
@@ -469,17 +481,18 @@ void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
}
static
-void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8] )
+void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8], void * data)
{
LGRECT work, clip;
struct gui_window * gw;
- short pxy[10];
- // FIXME: optimize this:
- gw = (struct gui_window *)mt_CompDataSearch(&app, c, CDT_OWNER);
- if( gw == NULL )
- return;
-
- CMP_TOOLBAR tb = gw->root->toolbar;
+ short pxy[10];
+ plot_style_t plot_style_background = {
+ .fill_type = PLOT_OP_TYPE_SOLID,
+ .fill_colour = toolbar_bg_color,
+ .stroke_type = PLOT_OP_TYPE_NONE
+ };
+
+ CMP_TOOLBAR tb = (CMP_TOOLBAR)data;
mt_CompGetLGrect(&app, tb->url.comp, WF_WORKXYWH, &work);
// this last pixel is drawn by the root component of the toolbar:
@@ -487,46 +500,23 @@ void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8] )
work.g_h--;
clip = work;
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[3] = clip.g_h + clip.g_y-1;
- vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
-
- vsf_perimeter(atari_plot_vdi_handle, 0 );
- vsf_interior(atari_plot_vdi_handle , 1 );
- vsf_color(atari_plot_vdi_handle, toolbar_styles[tb->style].bgcolor );
-
- //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(atari_plot_vdi_handle, 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(atari_plot_vdi_handle, 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(atari_plot_vdi_handle, 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(atari_plot_vdi_handle, pxy );
-
- vs_clip(atari_plot_vdi_handle, 0, (short*)&pxy );
+
+ plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
+
+ //left margin:
+ plot_rectangle(0, 0, TOOLBAR_URL_MARGIN_LEFT, work.g_h,
+ &plot_style_background);
+ // right margin:
+ plot_rectangle(work.g_w-TOOLBAR_URL_MARGIN_RIGHT, 0, work.g_w, work.g_h,
+ &plot_style_background);
+
+ // top margin:
+ plot_rectangle(0, 0, work.g_w, TOOLBAR_URL_MARGIN_TOP,
+ &plot_style_background);
+
+ // bottom margin:
+ plot_rectangle(0, work.g_h-TOOLBAR_URL_MARGIN_BOTTOM, work.g_w, work.g_h,
+ &plot_style_background);
// TBD: request redraw of textarea for specific region.
clip.g_x -= work.g_x+TOOLBAR_URL_MARGIN_LEFT;
@@ -611,14 +601,18 @@ void tb_adjust_size( struct gui_window * gw )
static void __CDECL evnt_toolbar_redraw( COMPONENT *c, long buff[8], void *data )
{
LGRECT work, clip;
- short pxy[4];
+ short pxy[4];
+ const plot_style_t plot_style_background = {
+ .fill_type = PLOT_OP_TYPE_SOLID,
+ .fill_colour = toolbar_bg_color,
+ .stroke_type = PLOT_OP_TYPE_NONE
+ };
mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
- clip = work;
+ clip = work;
if( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
-
- if( work.g_y + work.g_h != clip.g_y + clip.g_h ) return;
-
+ if( work.g_y + work.g_h != clip.g_y + clip.g_h ) return;
+
vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
vsl_color(atari_plot_vdi_handle, BLACK );
vsl_type(atari_plot_vdi_handle, 1 );
@@ -786,7 +780,7 @@ CMP_TOOLBAR tb_create( struct gui_window * gw )
t->url.comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL,
toolbar_styles[t->style].height, 1);
- mt_CompEvntAttach( &app, t->url.comp, WM_REDRAW, evnt_url_redraw );
+ mt_CompEvntDataAttach( &app, t->url.comp, WM_REDRAW, evnt_url_redraw, t);
mt_CompEvntAttach( &app, t->url.comp, WM_XBUTTON, evnt_url_click );
mt_CompDataAttach( &app, t->url.comp, CDT_OWNER, gw );
mt_CompAttach( &app, t->comp, t->url.comp );