static status RedrawAreaTextMargin(TextMargin m, Area a) { int x, y, w, h; Elevation z = getClassVariableValueObject(m, NAME_elevation); Any obg; initialiseDeviceGraphical(m, &x, &y, &w, &h); margin_x = x; margin_y = y; obg = r_background(m->background); r_clear(x, y, w, h); if ( z && notNil(z) ) r_3d_box(x, y, w, h, 0, z, FALSE); else { r_thickness(valInt(m->pen)); r_dash(m->texture); r_box(x, y, w, h, 0, NIL); } scan_fragment_icons(m, paint_fragment, NAME_forSome, NIL); RedrawAreaGraphical(m, a); r_background(obg); succeed; }
Any RedrawBoxFigure(Figure f, Area area) { Any rval = NIL; if ( f->pen != ZERO || notNil(f->background) || notNil(f->elevation) ) { int x, y, w, h; initialiseDeviceGraphical(f, &x, &y, &w, &h); if ( f->pen == ZERO && f->radius == ZERO && isNil(f->elevation) ) { r_fill(x, y, w, h, f->background); rval = f->background; } else { r_thickness(valInt(f->pen)); r_dash(f->texture); if ( notNil(f->elevation) ) { r_3d_box(x, y, w, h, valInt(f->radius), f->elevation, TRUE); rval = f->elevation->background; } else { r_box(x, y, w, h, valInt(f->radius), f->background); rval = f->background; } } } return rval; }
static int paste1_grid(void) { int x, y; render_full_screen(); if (!make_render_cashes()) return(0); for (x=vs.gridx; x<XMAX; x+=vs.gridw) { r_box(x,0,x,YMAX-1); } for (y=vs.gridy; y<YMAX; y+=vs.gridh) { r_box(0,y,XMAX-1,y); } free_render_cashes(); return(1); }
static void draw_generic_button_face(Button b, int x, int y, int w, int h, int up, int defb, int focus) { Elevation z = getClassVariableValueObject(b, NAME_elevation); int r = valInt(b->radius); if ( z && notNil(z) ) /* 3-d style */ { int up = (b->status == NAME_inactive || b->status == NAME_active); if ( b->look == NAME_motif || b->look == NAME_gtk || b->look == NAME_win ) { int bx = x, by = y, bw = w, bh = h; if ( b->look == NAME_motif || b->look == NAME_gtk ) { if ( b->show_focus_border == ON ) { PceWindow sw = getWindowGraphical((Graphical)b); Graphical kbfocus = (sw ? sw->keyboard_focus : NIL); if ( focus || kbfocus == (Graphical) b || /* inactive focus */ (defb && !instanceOfObject(kbfocus, ClassButton)) ) { static Elevation e = NULL; if ( !e ) e = newObject(ClassElevation, ONE, EAV); bx -= GTK_BUTTON_MARGIN; by -= GTK_BUTTON_MARGIN; bw += GTK_BUTTON_MARGIN * 2; bh += GTK_BUTTON_MARGIN * 2; r_3d_box(bx, by, bw, bh, r, e, FALSE); } } if ( focus ) { int pen = valInt(b->pen); if ( pen > 0 ) { r_thickness(pen); r_box(x-pen, y-pen, w+2*pen, h+2*pen, r, NIL); } } } else { if ( defb ) { int pen = valInt(b->pen); bx -= pen; by -= pen; bw += 2*pen; bh += 2*pen; r_thickness(pen); r_box(bx, by, bw, bh, r, NIL); } } } r_3d_box(x, y, w, h, r, z, up); if ( b->look == NAME_openLook && defb ) { Any old; old = r_colour(r_elevation_shadow(z)); r_box(x+2, y+2, w-4, h-4, r, NIL); r_colour(old); } } else /* 2-d style */ { int swapc = 0; int pen = valInt(b->pen); int radius = valInt(b->radius); int shadow = valInt(b->shadow); if ( defb && b->look != NAME_openLook ) pen++; r_thickness(pen); r_dash(b->texture); if ( up ) { r_shadow_box(x, y, w, h, radius, shadow, NIL); } else if ( b->status == NAME_preview ) { r_shadow_box(x, y, w, h, radius, shadow, BLACK_IMAGE); swapc = TRUE; } else if ( b->status == NAME_execute ) { r_shadow_box(x, y, w, h, radius, shadow, GREY25_IMAGE); } if ( swapc ) r_swap_background_and_foreground(); if ( defb && b->look == NAME_openLook ) r_box(x+pen, y+pen, w-2*pen-shadow, h-2*pen-shadow, radius, NIL); if ( swapc ) r_swap_background_and_foreground(); } }
static status RedrawAreaSlider(Slider s, Area a) { int x, y, w, h; int ny, vx, vy, lx, ly, sx, sy, hx, hy; int vv; int bw = (s->look == NAME_x ? BAR_WIDTH : OL_BOX_WIDTH); float lv = convert_value(s->low); float hv = convert_value(s->high); float dv = convert_value(s->displayed_value); int lflags = (s->active == ON ? 0 : LABEL_INACTIVE); if ( dv < lv ) dv = lv; else if ( dv > hv ) dv = hv; if ( hv > lv ) vv = rfloat(((float) (valInt(s->width) - bw) * (dv - lv)) / (hv - lv)); else vv = 0; initialiseDeviceGraphical(s, &x, &y, &w, &h); NormaliseArea(x, y, w, h); r_thickness(valInt(s->pen)); r_dash(s->texture); compute_slider(s, &ny, &vx, &vy, &lx, &ly, &sx, &sy, &hx, &hy); r_clear(x, y, w, h); if ( s->show_label == ON ) { int ex = valInt(getExFont(s->label_font)); RedrawLabelDialogItem(s, accelerator_code(s->accelerator), x, y+ny, vx-ex, 0, s->label_format, NAME_top, lflags); } if ( s->look == NAME_motif ) { int by = y+sy+(SLIDER_HEIGHT-OL_BAR_HEIGHT)/2; int ex = x + sx + valInt(s->width); Elevation z = getClassVariableValueObject(s, NAME_elevation); r_3d_box(x+sx, by, vv, OL_BAR_HEIGHT, 0, z, FALSE); r_3d_box(x+sx+vv+bw, by, ex-(x+sx+vv+bw), OL_BAR_HEIGHT, 0, z, FALSE); r_3d_box(x+sx+vv, y+sy, bw, SLIDER_HEIGHT, 0, z, TRUE); } else if ( s->look == NAME_openLook ) { int by = y+sy+(SLIDER_HEIGHT-OL_BAR_HEIGHT)/2; int ly2 = by+OL_BAR_HEIGHT-1; int ex = x + sx + valInt(s->width); r_fill(x+sx, by+1, 1, OL_BAR_HEIGHT-2, BLACK_IMAGE); r_fill(x+sx+1, by, vv-2, OL_BAR_HEIGHT, BLACK_IMAGE); r_line(x+sx+1+vv+bw, by, ex-2, by); r_line(x+sx+1+vv+bw, ly2, ex-2, ly2); r_line(ex-1, by+1, ex-1, ly2-1); r_shadow_box(x+sx+vv, y+sy, bw, SLIDER_HEIGHT, 0, 1, NIL); } else { r_fill(x+sx, y+sy, vv, SLIDER_HEIGHT, GREY50_IMAGE); r_box(x+sx, y+sy, valInt(s->width), SLIDER_HEIGHT, 0, NIL); r_fill(x+sx+vv, y+sy, bw, SLIDER_HEIGHT, BLACK_IMAGE); } if ( s->show_value == ON ) { char buf[100]; string str; buf[0] = '['; format_value(s, &buf[1], s->displayed_value); strcat(buf, "]"); str_set_ascii(&str, buf); str_label(&str, 0, s->value_font, x+vx, y+vy, 0, 0, NAME_left, NAME_top, lflags); format_value(s, buf, s->low); str_set_ascii(&str, buf); str_label(&str, 0, s->value_font, x+lx, y+ly, 0, 0, NAME_left, NAME_top, lflags); format_value(s, buf, s->high); str_set_ascii(&str, buf); str_label(&str, 0, s->value_font, x+hx, y+hy, 0, 0, NAME_left, NAME_top, lflags); } return RedrawAreaGraphical(s, a); }