Migliorata grafica botton e testate sheet

git-svn-id: svn://10.65.10.50/branches/R_10_00@22661 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-05-23 14:39:41 +00:00
parent 5abc07f468
commit 5d8a5b2a73
6 changed files with 6078 additions and 5870 deletions

37
xi/xi.c
View File

@ -1227,7 +1227,7 @@ xi_draw_field_button( XI_OBJ * xi_obj )
xi_inflate_rect( &r, -1 ); xi_inflate_rect( &r, -1 );
if ( ( BOOLEAN ) xi_get_pref( XI_PREF_3D_LOOK ) ) if ( ( BOOLEAN ) xi_get_pref( XI_PREF_3D_LOOK ) )
xi_draw_3d_rect(win, &r, fd->down, button_depth, color_light, color_ctrl, color_dark); xi_draw_shaded_rect(win, &r, fd->down, button_depth, color_light, color_ctrl, color_dark);
else else
{ {
XinWindowBrushSet( win, &white_cbrush ); XinWindowBrushSet( win, &white_cbrush );
@ -1668,17 +1668,14 @@ draw_list_button( XinWindow win, XinRect * rct, BOOLEAN down )
XinWindowPenSet( win, &black_cpen ); XinWindowPenSet( win, &black_cpen );
XinWindowBrushSet( win, &hollow_cbrush ); XinWindowBrushSet( win, &hollow_cbrush );
xi_draw_rect( win, &r ); xi_draw_rect( win, &r );
r.top++; xi_inflate_rect(&r, -1);
r.left++;
r.bottom--;
r.right--;
if ( ( BOOLEAN ) xi_get_pref( XI_PREF_3D_LOOK ) ) if ( ( BOOLEAN ) xi_get_pref( XI_PREF_3D_LOOK ) )
{ {
const XinColor color_light = aga_get_pref(AGA_PREF_BTN_COLOR_LIGHT); const XinColor color_light = aga_get_pref(AGA_PREF_BTN_COLOR_LIGHT);
const XinColor color_ctrl = aga_get_pref(AGA_PREF_BTN_COLOR_CTRL); const XinColor color_ctrl = aga_get_pref(AGA_PREF_BTN_COLOR_CTRL);
const XinColor color_dark = aga_get_pref(AGA_PREF_BTN_COLOR_DARK); const XinColor color_dark = aga_get_pref(AGA_PREF_BTN_COLOR_DARK);
xi_draw_3d_rect(win, &r, down, 2, color_light, color_ctrl, color_dark); xi_draw_shaded_rect(win, &r, down, 2, color_light, color_ctrl, color_dark);
} }
else else
{ {
@ -3430,7 +3427,6 @@ xi_draw_button( XI_OBJ * xi_obj, XinRect * rct,
case XIBT_BUTTON_CHECKBOX: case XIBT_BUTTON_CHECKBOX:
case XIBT_BUTTON_RADIOBTN: case XIBT_BUTTON_RADIOBTN:
{ {
int grid_width;
int bline = -1; int bline = -1;
XinRect r; XinRect r;
XinPen back_pen; XinPen back_pen;
@ -3453,7 +3449,7 @@ xi_draw_button( XI_OBJ * xi_obj, XinRect * rct,
r = *rct; r = *rct;
if ( xi_obj->v.btn->packed == TRUE ) if ( xi_obj->v.btn->packed == TRUE )
{ {
grid_width = ( int ) xi_get_pref( XI_PREF_CONTAINER_GRID_WIDTH ); int grid_width = ( int ) xi_get_pref( XI_PREF_CONTAINER_GRID_WIDTH );
xi_inflate_rect( &r, -grid_width ); xi_inflate_rect( &r, -grid_width );
} }
else else
@ -3463,10 +3459,15 @@ xi_draw_button( XI_OBJ * xi_obj, XinRect * rct,
bt = xi_obj->v.btn->type; bt = xi_obj->v.btn->type;
if ( bt == XIBT_BUTTON || bt == XIBT_BUTTON_CHECKBOX || if ( bt == XIBT_BUTTON || bt == XIBT_BUTTON_CHECKBOX ||
bt == XIBT_BUTTON_RADIOBTN ) bt == XIBT_BUTTON_RADIOBTN )
xi_inflate_rect( &r, -3 ); xi_inflate_rect( &r, -1 ); // Was -3
} }
XinWindowDrawModeSet( win, XinDrawModeCopy ); XinWindowDrawModeSet( win, XinDrawModeCopy );
xi_draw_3d_rect( win, &r, ( BOOLEAN ) ( down || bd->checked ), 2, color_light, color_ctrl, color_dark );
if ( ( BOOLEAN ) xi_get_pref( XI_PREF_3D_LOOK ) )
xi_draw_shaded_rect( win, &r, ( BOOLEAN ) ( down || bd->checked ), 2, color_light, color_ctrl, color_dark );
else
xi_draw_3d_rect( win, &r, ( BOOLEAN ) ( down || bd->checked ), 2, color_light, color_ctrl, color_dark );
if ( bd->up_icon_rid ) if ( bd->up_icon_rid )
{ {
int x, int x,
@ -3521,7 +3522,10 @@ xi_draw_button( XI_OBJ * xi_obj, XinRect * rct,
( XinColor ) xi_get_pref( XI_PREF_COLOR_DISABLED ) ); ( XinColor ) xi_get_pref( XI_PREF_COLOR_DISABLED ) );
text_rect = r; text_rect = r;
if ( down ) if ( down )
{
text_rect.top += 2; text_rect.top += 2;
text_rect.left += 2;
}
fontp = xi_obj->v.btn->font; fontp = xi_obj->v.btn->font;
if ( fontp == NULL ) if ( fontp == NULL )
fontp = xi_obj->itf->v.itf->font; fontp = xi_obj->itf->v.itf->font;
@ -3919,7 +3923,12 @@ xi_draw_button( XI_OBJ * xi_obj, XinRect * rct,
xi_draw_thick_rect( win, &rct2, 2 ); xi_draw_thick_rect( win, &rct2, 2 );
} }
else else
xi_draw_3d_rect( win, &rct2, down, 1, 0L, 0L, 0L ); {
if ( ( BOOLEAN ) xi_get_pref( XI_PREF_3D_LOOK ) )
xi_draw_shaded_rect( win, &rct2, down, 1, 0L, 0L, 0L );
else
xi_draw_3d_rect( win, &rct2, down, 1, 0L, 0L, 0L );
}
if ( !enabled ) if ( !enabled )
fore_cp.fore_color = xi_get_pref( XI_PREF_COLOR_DISABLED ); fore_cp.fore_color = xi_get_pref( XI_PREF_COLOR_DISABLED );
if ( checked ) if ( checked )
@ -3958,6 +3967,12 @@ xi_draw_button( XI_OBJ * xi_obj, XinRect * rct,
pnt1.v++; pnt1.v++;
xi_move_to( win, pnt1 ); xi_move_to( win, pnt1 );
xi_draw_line( win, pnt2 ); xi_draw_line( win, pnt2 );
/* Sarebbe bello ma ... non è trasparente
XinRect rct3 = rct2;
xi_inflate_rect(&rct3, -2);
xi_draw_checkmark(win, &rct3);
*/
} }
if ( !box_only ) if ( !box_only )
{ {

View File

@ -224,6 +224,7 @@ typedef enum
AGA_PREF_BTN_COLOR_LIGHT, AGA_PREF_BTN_COLOR_LIGHT,
AGA_PREF_BTN_COLOR_CTRL, AGA_PREF_BTN_COLOR_CTRL,
AGA_PREF_BTN_COLOR_DARK, AGA_PREF_BTN_COLOR_DARK,
AGA_PREF_BTN_COLOR_TEXT,
AGA_PREF_LASTPREF /* should always be last */ AGA_PREF_LASTPREF /* should always be last */
} }
AGA_PREF_TYPE; AGA_PREF_TYPE;
@ -1443,9 +1444,11 @@ XIDLL void xi_draw_3d_diamond XVT_CC_ARGS( ( XinWindow win, XinRect * rctp, BO
XIDLL void xi_draw_3d_line XVT_CC_ARGS( ( XinWindow win, XinPoint pnt1, XinPoint pnt2, BOOLEAN well ) ); XIDLL void xi_draw_3d_line XVT_CC_ARGS( ( XinWindow win, XinPoint pnt1, XinPoint pnt2, BOOLEAN well ) );
XIDLL void xi_draw_3d_rect XVT_CC_ARGS( ( XinWindow win, XinRect * rctp, BOOLEAN well, int height, XinColor XIDLL void xi_draw_3d_rect XVT_CC_ARGS( ( XinWindow win, XinRect * rctp, BOOLEAN well, int height, XinColor
color_light, XinColor color_ctrl, XinColor color_dark ) ); color_light, XinColor color_ctrl, XinColor color_dark ) );
XIDLL void xi_draw_diamond XVT_CC_ARGS( ( XinWindow win, XinRect * rctp, BOOLEAN well, BOOLEAN black, BOOLEAN XIDLL void xi_draw_shaded_rect XVT_CC_ARGS( ( XinWindow win, XinRect * rctp, BOOLEAN well, int height, XinColor
fill, color_light, XinColor color_ctrl, XinColor color_dark ) );
XinColor color ) ); XIDLL void xi_draw_diamond XVT_CC_ARGS( ( XinWindow win, XinRect * rctp, BOOLEAN well, BOOLEAN black, BOOLEAN fill, XinColor color ) );
XIDLL void xi_draw_checkmark XVT_CC_ARGS( ( XinWindow win, XinRect * rctp ) );
XIDLL void xi_draw_text_attrib XVT_CC_ARGS( ( XinWindow win, XinFont * font, int x, int y, char *s, int len, unsigned XIDLL void xi_draw_text_attrib XVT_CC_ARGS( ( XinWindow win, XinFont * font, int x, int y, char *s, int len, unsigned
long attrib ) ); long attrib ) );
XIDLL void xi_draw_thick_rect XVT_CC_ARGS( ( XinWindow win, XinRect * rctp, int width ) ); XIDLL void xi_draw_thick_rect XVT_CC_ARGS( ( XinWindow win, XinRect * rctp, int width ) );

View File

@ -173,8 +173,7 @@ static void
lm_draw_3d_rect( LM_DATA * lmp, XinRect * rctp, BOOLEAN well, int depth, BOOLEAN adj_v ) lm_draw_3d_rect( LM_DATA * lmp, XinRect * rctp, BOOLEAN well, int depth, BOOLEAN adj_v )
{ {
XinRect r; XinRect r;
BOOLEAN left, BOOLEAN left, right;
right;
const XinColor color_light = aga_get_pref(AGA_PREF_BTN_COLOR_LIGHT); const XinColor color_light = aga_get_pref(AGA_PREF_BTN_COLOR_LIGHT);
const XinColor color_ctrl = aga_get_pref(AGA_PREF_BTN_COLOR_CTRL); const XinColor color_ctrl = aga_get_pref(AGA_PREF_BTN_COLOR_CTRL);
const XinColor color_dark = aga_get_pref(AGA_PREF_BTN_COLOR_DARK); const XinColor color_dark = aga_get_pref(AGA_PREF_BTN_COLOR_DARK);
@ -194,7 +193,11 @@ lm_draw_3d_rect( LM_DATA * lmp, XinRect * rctp, BOOLEAN well, int depth, BOOLEAN
right = lm_adj_h( lmp, &r.right ); right = lm_adj_h( lmp, &r.right );
if ( !left && !right ) if ( !left && !right )
return; return;
xi_draw_3d_rect( lmp->win, &r, well, depth, color_light, color_ctrl, color_dark);
if ( xi_get_pref( XI_PREF_3D_LOOK ) )
xi_draw_shaded_rect( lmp->win, &r, well, depth, color_light, color_ctrl, color_dark);
else
xi_draw_3d_rect( lmp->win, &r, well, depth, color_light, color_ctrl, color_dark);
} }
/*********** draw column headings ***********/ /*********** draw column headings ***********/
@ -279,6 +282,7 @@ draw_column_headings( LM_DATA * lmp, XinRect * actual_rct )
cell_rct.right--; cell_rct.right--;
cell_rct.top++; cell_rct.top++;
cell_rct.bottom = heading_rct.bottom - 2 + BORDER_WIDTH; cell_rct.bottom = heading_rct.bottom - 2 + BORDER_WIDTH;
/* Reimplemented below 10/05/2012
if ( COLUMN_IS_ENABLED( lm, col ) ) if ( COLUMN_IS_ENABLED( lm, col ) )
{ {
if ( LIST_IS_ENABLED( lmp ) ) if ( LIST_IS_ENABLED( lmp ) )
@ -292,8 +296,12 @@ draw_column_headings( LM_DATA * lmp, XinRect * actual_rct )
fore_color = lmp->disabled_color; fore_color = lmp->disabled_color;
back_color = lmp->disabled_back_color; back_color = lmp->disabled_back_color;
} }
if ( col_data->heading_well || col_data->heading_platform ) */
if ( col_data->heading_well || col_data->heading_platform ) // Alway true ???
{
fore_color = aga_get_pref(AGA_PREF_BTN_COLOR_TEXT);
back_color = aga_get_pref(AGA_PREF_BTN_COLOR_CTRL); back_color = aga_get_pref(AGA_PREF_BTN_COLOR_CTRL);
}
XinWindowColorTextForeSet( win, fore_color ); XinWindowColorTextForeSet( win, fore_color );
XinWindowColorTextBackSet( win, back_color ); XinWindowColorTextBackSet( win, back_color );
} }
@ -413,7 +421,7 @@ draw_column_headings( LM_DATA * lmp, XinRect * actual_rct )
ascent, ascent,
descent; descent;
s = XinMemoryAlloc( strlen( col_data->heading_text ) + 1 ); s = (char*)XinMemoryAlloc( strlen( col_data->heading_text ) + 1 );
strcpy( s, col_data->heading_text ); strcpy( s, col_data->heading_text );
ch = s; ch = s;
first_char = ch; first_char = ch;
@ -1620,8 +1628,12 @@ TO OPTIMIZE BACKGROUND DRAWING, USE NEXT TWO LINES
const XinColor color_ctrl = aga_get_pref(AGA_PREF_BTN_COLOR_CTRL); const XinColor color_ctrl = aga_get_pref(AGA_PREF_BTN_COLOR_CTRL);
const XinColor color_dark = aga_get_pref(AGA_PREF_BTN_COLOR_DARK); const XinColor color_dark = aga_get_pref(AGA_PREF_BTN_COLOR_DARK);
xi_draw_3d_rect( win, &rct, ( BOOLEAN ) ( CELL_IS_SELECTED( lmp, row, col ) ? !column_data->column_well : if ( xi_get_pref( XI_PREF_3D_LOOK ) )
column_data->column_well ), 2, color_light, color_ctrl, color_dark ); xi_draw_shaded_rect( win, &rct, ( BOOLEAN ) ( CELL_IS_SELECTED( lmp, row, col ) ? !column_data->column_well :
column_data->column_well ), 2, color_light, color_ctrl, color_dark );
else
xi_draw_3d_rect( win, &rct, ( BOOLEAN ) ( CELL_IS_SELECTED( lmp, row, col ) ? !column_data->column_well :
column_data->column_well ), 2, color_light, color_ctrl, color_dark );
} }
} }
} }

View File

@ -3610,6 +3610,66 @@ XinWindowDottedRectDraw( XinWindow Win, XinRect * rctp )
/*START*/ /*START*/
} }
static XinColor ModulateColour(XinColor col, int percent)
{
int r,g,b,k = 0, inverse = 100;
if (percent > 0)
k = 255;
else
percent = -percent;
inverse = 100-percent;
r = ((k * percent) + (((col>>16)&0xFF) * inverse)) / 100;
g = ((k * percent) + (((col>> 8)&0xFF) * inverse)) / 100;
b = ((k * percent) + (((col>> 0)&0xFF) * inverse)) / 100;
return XinColorMake(r, g, b);
}
/*
this function draws a shaded rectangle in the specified window (added by Guy).
*/
void
XinWindowShadedRectDraw( XinWindow Win, XinRect * rctp )
{
/*END*/
XinDrawTools tools;
XinColor c1, c2, c0;
RCT r;
XinWindowDrawToolsGet( Win, &tools );
c0 = tools.brush.fore_color;
c1 = ModulateColour(tools.brush.fore_color, +20);
c2 = ModulateColour(tools.brush.fore_color, -20);
r.left = rctp->left;
r.top = rctp->top;
r.right = rctp->right;
r.bottom = rctp->top + 1*(rctp->bottom-rctp->top)/4;
xvt_dwin_draw_gradient_linear((WINDOW)Win, &r, c0, c0, 90);
r.top = r.bottom;
r.bottom = rctp->bottom;
xvt_dwin_draw_gradient_linear((WINDOW)Win, &r, c1, c2, 90);
/*START*/
}
/*
this function draws a check mark in the specified window (added by Guy).
*/
void
XinWindowCheckMarkDraw( XinWindow Win, XinRect * rctp )
{
/*END*/
RCT r;
r.left = rctp->left;
r.top = rctp->top;
r.right = rctp->right;
r.bottom = rctp->bottom;
xvt_dwin_draw_checkmark((WINDOW)Win, &r);
/*START*/
}
/* /*
this function fills in the rectangle passed in as a pointer 'Rctp' with the this function fills in the rectangle passed in as a pointer 'Rctp' with the
@ -3846,8 +3906,11 @@ XinWindowTextDraw( XinWindow Win, XinFont * font, int x, int y,
char *buf, int len ) char *buf, int len )
{ {
/*END*/ /*END*/
xvt_dwin_set_font( ( WINDOW ) Win, font->xvt_fntid ); if (buf && *buf && len)
xvt_dwin_draw_text( ( WINDOW ) Win, x, y, buf, len ); {
xvt_dwin_set_font( ( WINDOW ) Win, font->xvt_fntid );
xvt_dwin_draw_text( ( WINDOW ) Win, x, y, buf, len );
}
/*START*/ /*START*/
} }

View File

@ -693,6 +693,8 @@ extern "C"
void XinWindowRectDraw( XinWindow win, XinRect * rect ); void XinWindowRectDraw( XinWindow win, XinRect * rect );
void XinWindowDottedRectDraw( XinWindow win, XinRect * rect ); /* Added by Guy */ void XinWindowDottedRectDraw( XinWindow win, XinRect * rect ); /* Added by Guy */
void XinWindowRoundRectDraw( XinWindow win, XinRect * rect, int rh, int rv ); /* Added by Guy */ void XinWindowRoundRectDraw( XinWindow win, XinRect * rect, int rh, int rv ); /* Added by Guy */
void XinWindowShadedRectDraw( XinWindow win, XinRect * rect ); /* Added by Guy */
void XinWindowCheckMarkDraw( XinWindow win, XinRect * rect ); /* Added by Guy */
XinRect *XinWindowRectGet( XinWindow win, XinRect * p_rect ); XinRect *XinWindowRectGet( XinWindow win, XinRect * p_rect );
void XinWindowRectInvalidate( XinWindow win, XinRect * rect ); void XinWindowRectInvalidate( XinWindow win, XinRect * rect );

View File

@ -335,7 +335,7 @@ static long xi_preferences[XI_NBR_PREFERENCES] =
#endif #endif
}; };
static long aga_preferences[AGA_NBR_PREFERENCES] = { XI_COLOR_LTGRAY, XI_COLOR_GRAY, XI_COLOR_DKGRAY}; static long aga_preferences[AGA_NBR_PREFERENCES] = { XI_COLOR_LTGRAY, XI_COLOR_GRAY, XI_COLOR_DKGRAY, XI_COLOR_BLACK };
XinRect big_clip = { XinRect big_clip = {
@ -1100,6 +1100,119 @@ xi_draw_3d_rect( XinWindow win, XinRect * rctp, BOOLEAN well, int height,
xi_draw_rect( win, &rct ); xi_draw_rect( win, &rct );
} }
void
xi_draw_shaded_rect( XinWindow win, XinRect * rctp, BOOLEAN well, int height,
XinColor color_light, XinColor color_ctrl, XinColor color_dark )
{
XinRect rct;
XinPoint pnt,
pnt2;
XinPen cpen;
XinBrush cbrush;
if ( !color_light )
{
color_light = xi_get_pref( XI_PREF_COLOR_LIGHT );
color_ctrl = xi_get_pref( XI_PREF_COLOR_CTRL );
color_dark = xi_get_pref( XI_PREF_COLOR_DARK );
}
cpen = black_cpen;
rct = *rctp;
XinWindowDrawModeSet( win, XinDrawModeCopy );
/* draw upper left lines */
cpen.fore_color = well ? color_dark : color_light;
XinWindowPenSet( win, &cpen );
pnt.h = rct.left;
pnt.v = rct.top;
xi_move_to( win, pnt );
pnt2.h = rct.left;
pnt2.v = rct.bottom - 1;
xi_draw_line( win, pnt2 );
xi_move_to( win, pnt );
pnt2.h = rct.right - 1;
pnt2.v = rct.top;
xi_draw_line( win, pnt2 );
if ( height == 2 )
{
pnt.h++;
pnt.v++;
xi_move_to( win, pnt );
pnt2.h = pnt.h;
pnt2.v = rct.bottom - 2;
xi_draw_line( win, pnt2 );
xi_move_to( win, pnt );
pnt2.h = rct.right - 2;
pnt2.v = pnt.v;
xi_draw_line( win, pnt2 );
}
/* draw lower right lines */
cpen.fore_color = well ? color_light : color_dark;
XinWindowPenSet( win, &cpen );
pnt.h = rct.left;
pnt.v = rct.bottom - 1;
xi_move_to( win, pnt );
pnt2.h = rct.right - 1;
pnt2.v = pnt.v;
xi_draw_line( win, pnt2 );
pnt.h = rct.right - 1;
pnt.v = rct.top;
xi_move_to( win, pnt );
pnt2.h = pnt.h;
pnt2.v = rct.bottom;
xi_draw_line( win, pnt2 );
if ( height == 2 )
{
pnt.h = rct.left + 1;
pnt.v = rct.bottom - 2;;
xi_move_to( win, pnt );
pnt2.h = rct.right - 1;
pnt2.v = pnt.v;
xi_draw_line( win, pnt2 );
pnt.h = rct.right - 2;
pnt.v = rct.top + 1;
xi_move_to( win, pnt );
pnt2.h = pnt.h;
pnt2.v = rct.bottom;
xi_draw_line( win, pnt2 );
}
XinWindowPenSet( win, &hollow_cpen );
cbrush = white_cbrush;
cbrush.fore_color = color_ctrl;
XinWindowBrushSet( win, &cbrush );
if ( height == 2 )
{
rct.top += 2;
rct.left += 2;
rct.bottom -= 2;
rct.right -= 2;
}
else
{
rct.top++;
rct.left++;
rct.bottom--;
rct.right--;
}
XinWindowShadedRectDraw(win, &rct);
}
void
xi_draw_checkmark( XinWindow win, XinRect * rctp )
{
XinWindowCheckMarkDraw( win, rctp );
}
void void
xi_draw_3d_line( XinWindow win, XinPoint pnt1, XinPoint pnt2, BOOLEAN well ) xi_draw_3d_line( XinWindow win, XinPoint pnt1, XinPoint pnt2, BOOLEAN well )
{ {