--- rxvt-unicode/src/scrollbar-next.C 2003/11/24 17:31:28 1.2 +++ rxvt-unicode/src/scrollbar-next.C 2004/01/31 00:20:21 1.5 @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: scrollbar-next.c *----------------------------------------------------------------------* - * $Id: scrollbar-next.C,v 1.2 2003/11/24 17:31:28 pcg Exp $ + * $Id: scrollbar-next.C,v 1.5 2004/01/31 00:20:21 pcg Exp $ * * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1998 Alfredo K. Kojima @@ -111,36 +111,34 @@ " " }; -/* INTPROTO */ Pixmap -rxvt_renderPixmap(pR_ const char *const *data, int width, int height) +rxvt_term::renderPixmap (const char *const *data, int width, int height) { char a; int x, y; Pixmap d; GC pointcolour; - d = XCreatePixmap(R->Xdisplay, R->scrollBar.win, width, height, XDEPTH); + d = XCreatePixmap(Xdisplay, scrollBar.win, width, height, XDEPTH); for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { if ((a = data[y][x]) == ' ' || a == 'w') - pointcolour = R->h->whiteGC; + pointcolour = whiteGC; else if (a == '.' || a == 'l') - pointcolour = R->h->grayGC; + pointcolour = grayGC; else if (a == '%' || a == 'd') - pointcolour = R->h->darkGC; + pointcolour = darkGC; else /* if (a == '#' || a == 'b' || a) */ - pointcolour = R->h->blackGC; - XDrawPoint(R->Xdisplay, d, pointcolour, x, y); + pointcolour = blackGC; + XDrawPoint(Xdisplay, d, pointcolour, x, y); } } return d; } -/* INTPROTO */ void -rxvt_init_scrollbar_stuff(pR) +rxvt_term::init_scrollbar_stuff () { XGCValues gcvalue; XColor xcol; @@ -149,33 +147,33 @@ gcvalue.graphics_exposures = False; - gcvalue.foreground = R->PixColors[Color_Black]; - R->h->blackGC = XCreateGC(R->Xdisplay, R->scrollBar.win, + gcvalue.foreground = PixColors[Color_Black]; + blackGC = XCreateGC(Xdisplay, scrollBar.win, GCForeground | GCGraphicsExposures, &gcvalue); - gcvalue.foreground = R->PixColors[Color_White]; - R->h->whiteGC = XCreateGC(R->Xdisplay, R->scrollBar.win, + gcvalue.foreground = PixColors[Color_White]; + whiteGC = XCreateGC(Xdisplay, scrollBar.win, GCForeground | GCGraphicsExposures, &gcvalue); xcol.red = 0xaeba; xcol.green = 0xaaaa; xcol.blue = 0xaeba; - if (!rxvt_rXAllocColor(aR_ &xcol, "light gray")) - xcol.pixel = R->PixColors[Color_AntiqueWhite]; + //if (!rXAllocColor (&xcol, "light gray"))//TODO//D// + xcol.pixel = PixColors[Color_AntiqueWhite]; light = gcvalue.foreground = xcol.pixel; - R->h->grayGC = XCreateGC(R->Xdisplay, R->scrollBar.win, + grayGC = XCreateGC(Xdisplay, scrollBar.win, GCForeground | GCGraphicsExposures, &gcvalue); xcol.red = 0x51aa; xcol.green = 0x5555; xcol.blue = 0x5144; - if (!rxvt_rXAllocColor(aR_ &xcol, "dark gray")) - xcol.pixel = R->PixColors[Color_Grey25]; + //if (!rXAllocColor (&xcol, "dark gray"))//TODO//D// + xcol.pixel = PixColors[Color_Grey25]; dark = gcvalue.foreground = xcol.pixel; - R->h->darkGC = XCreateGC(R->Xdisplay, R->scrollBar.win, + darkGC = XCreateGC(Xdisplay, scrollBar.win, GCForeground | GCGraphicsExposures, &gcvalue); - stipple = XCreateBitmapFromData(R->Xdisplay, R->scrollBar.win, + stipple = XCreateBitmapFromData(Xdisplay, scrollBar.win, (char *)n_stp_bits, n_stp_width, n_stp_height); @@ -184,102 +182,100 @@ gcvalue.fill_style = FillOpaqueStippled; gcvalue.stipple = stipple; -/* XSetWindowBackground(R->Xdisplay, R->scrollBar.win, R->PixColors[Color_Red]); */ +/* XSetWindowBackground(Xdisplay, scrollBar.win, PixColors[Color_Red]); */ - R->h->stippleGC = XCreateGC(R->Xdisplay, R->scrollBar.win, + stippleGC = XCreateGC(Xdisplay, scrollBar.win, GCForeground | GCBackground | GCStipple | GCFillStyle | GCGraphicsExposures, &gcvalue); - R->h->dimple = rxvt_renderPixmap(aR_ SCROLLER_DIMPLE, SCROLLER_DIMPLE_WIDTH, + dimple = renderPixmap (SCROLLER_DIMPLE, SCROLLER_DIMPLE_WIDTH, SCROLLER_DIMPLE_HEIGHT); - R->h->upArrow = rxvt_renderPixmap(aR_ SCROLLER_ARROW_UP, ARROW_WIDTH, + upArrow = renderPixmap (SCROLLER_ARROW_UP, ARROW_WIDTH, ARROW_HEIGHT); - R->h->downArrow = rxvt_renderPixmap(aR_ SCROLLER_ARROW_DOWN, ARROW_WIDTH, + downArrow = renderPixmap (SCROLLER_ARROW_DOWN, ARROW_WIDTH, ARROW_HEIGHT); - R->h->upArrowHi = rxvt_renderPixmap(aR_ HI_SCROLLER_ARROW_UP, ARROW_WIDTH, + upArrowHi = renderPixmap (HI_SCROLLER_ARROW_UP, ARROW_WIDTH, ARROW_HEIGHT); - R->h->downArrowHi = rxvt_renderPixmap(aR_ HI_SCROLLER_ARROW_DOWN, + downArrowHi = renderPixmap (HI_SCROLLER_ARROW_DOWN, ARROW_WIDTH, ARROW_HEIGHT); } /* Draw bevel & arrows */ -/* INTPROTO */ void -rxvt_drawBevel(pR_ Drawable d, int x1, int y1, int w, int h) +rxvt_term::drawBevel (Drawable d, int x1, int y1, int w, int h) { int x2, y2; x2 = x1 + w - 1; /* right point */ y2 = y1 + h - 1; /* bottom point */ /* white top and left */ - XDrawLine(R->Xdisplay, d, R->h->whiteGC, x1, y1, x2, y1); - XDrawLine(R->Xdisplay, d, R->h->whiteGC, x1, y1, x1, y2); + XDrawLine(Xdisplay, d, whiteGC, x1, y1, x2, y1); + XDrawLine(Xdisplay, d, whiteGC, x1, y1, x1, y2); /* black bottom and right */ - XDrawLine(R->Xdisplay, d, R->h->blackGC, x1, y2, x2, y2); - XDrawLine(R->Xdisplay, d, R->h->blackGC, x2, y1, x2, y2); + XDrawLine(Xdisplay, d, blackGC, x1, y2, x2, y2); + XDrawLine(Xdisplay, d, blackGC, x2, y1, x2, y2); /* dark inside bottom and right */ x1++, y1++, x2--, y2--; /* move in one point */ - XDrawLine(R->Xdisplay, d, R->h->darkGC, x1, y2, x2, y2); - XDrawLine(R->Xdisplay, d, R->h->darkGC, x2, y1, x2, y2); + XDrawLine(Xdisplay, d, darkGC, x1, y2, x2, y2); + XDrawLine(Xdisplay, d, darkGC, x2, y1, x2, y2); } -/* EXTPROTO */ int -rxvt_scrollbar_show_next(pR_ int update, int last_top, int last_bot, int scrollbar_len) +rxvt_term::scrollbar_show_next (int update, int last_top, int last_bot, int scrollbar_len) { - int height = R->scrollBar.end + SB_BUTTON_TOTAL_HEIGHT + SB_PADDING; + int height = scrollBar.end + SB_BUTTON_TOTAL_HEIGHT + SB_PADDING; Drawable s; - if ((R->scrollBar.init & R_SB_NEXT) == 0) { - R->scrollBar.init |= R_SB_NEXT; - rxvt_init_scrollbar_stuff(aR); + if ((scrollBar.init & R_SB_NEXT) == 0) { + scrollBar.init |= R_SB_NEXT; + init_scrollbar_stuff (); } - if (R->TermWin.nscrolled == 0 || !update) { - XFillRectangle(R->Xdisplay, R->scrollBar.win, R->h->grayGC, 0, 0, + if (TermWin.nscrolled == 0 || !update) { + XFillRectangle(Xdisplay, scrollBar.win, grayGC, 0, 0, SB_WIDTH_NEXT + 1, height); - XDrawRectangle(R->Xdisplay, R->scrollBar.win, R->h->blackGC, 0, + XDrawRectangle(Xdisplay, scrollBar.win, blackGC, 0, -SB_BORDER_WIDTH, SB_WIDTH_NEXT, height + SB_BORDER_WIDTH); - XFillRectangle(R->Xdisplay, R->scrollBar.win, R->h->stippleGC, + XFillRectangle(Xdisplay, scrollBar.win, stippleGC, SB_LEFT_PADDING, 0, SB_BUTTON_WIDTH, height); } - if (R->TermWin.nscrolled) { - if (last_top < R->scrollBar.top || !update) - XFillRectangle(R->Xdisplay, R->scrollBar.win, R->h->stippleGC, + if (TermWin.nscrolled) { + if (last_top < scrollBar.top || !update) + XFillRectangle(Xdisplay, scrollBar.win, stippleGC, SB_LEFT_PADDING, SB_PADDING + last_top, - SB_BUTTON_WIDTH, R->scrollBar.top - last_top); - if (R->scrollBar.bot < last_bot || !update) - XFillRectangle(R->Xdisplay, R->scrollBar.win, R->h->stippleGC, - SB_LEFT_PADDING, R->scrollBar.bot + SB_PADDING, - SB_BUTTON_WIDTH, (last_bot - R->scrollBar.bot)); - XFillRectangle(R->Xdisplay, R->scrollBar.win, R->h->grayGC, - SB_LEFT_PADDING, R->scrollBar.top + SB_PADDING, + SB_BUTTON_WIDTH, scrollBar.top - last_top); + if (scrollBar.bot < last_bot || !update) + XFillRectangle(Xdisplay, scrollBar.win, stippleGC, + SB_LEFT_PADDING, scrollBar.bot + SB_PADDING, + SB_BUTTON_WIDTH, (last_bot - scrollBar.bot)); + XFillRectangle(Xdisplay, scrollBar.win, grayGC, + SB_LEFT_PADDING, scrollBar.top + SB_PADDING, SB_BUTTON_WIDTH, scrollbar_len); - XCopyArea(R->Xdisplay, R->h->dimple, R->scrollBar.win, R->h->whiteGC, 0, 0, + XCopyArea(Xdisplay, dimple, scrollBar.win, whiteGC, 0, 0, SCROLLER_DIMPLE_WIDTH, SCROLLER_DIMPLE_HEIGHT, (SB_WIDTH_NEXT - SCROLLER_DIMPLE_WIDTH) / 2, - R->scrollBar.top + SB_BEVEL_WIDTH_UPPER_LEFT + + scrollBar.top + SB_BEVEL_WIDTH_UPPER_LEFT + (scrollbar_len - SCROLLER_DIMPLE_HEIGHT) / 2); - rxvt_drawBevel(aR_ R->scrollBar.win, SB_BUTTON_BEVEL_X, - R->scrollBar.top + SB_PADDING, SB_BUTTON_WIDTH, + drawBevel (scrollBar.win, SB_BUTTON_BEVEL_X, + scrollBar.top + SB_PADDING, SB_BUTTON_WIDTH, scrollbar_len); - rxvt_drawBevel(aR_ R->scrollBar.win, SB_BUTTON_BEVEL_X, + drawBevel (scrollBar.win, SB_BUTTON_BEVEL_X, height - SB_BUTTON_BOTH_HEIGHT, SB_BUTTON_WIDTH, SB_BUTTON_HEIGHT); - rxvt_drawBevel(aR_ R->scrollBar.win, SB_BUTTON_BEVEL_X, + drawBevel (scrollBar.win, SB_BUTTON_BEVEL_X, height - SB_BUTTON_SINGLE_HEIGHT, SB_BUTTON_WIDTH, SB_BUTTON_HEIGHT); - s = (scrollbar_isUp()) ? R->h->upArrowHi : R->h->upArrow; - XCopyArea(R->Xdisplay, s, R->scrollBar.win, R->h->whiteGC, 0, 0, + s = (scrollbar_isUp()) ? upArrowHi : upArrow; + XCopyArea(Xdisplay, s, scrollBar.win, whiteGC, 0, 0, ARROW_WIDTH, ARROW_HEIGHT, SB_BUTTON_FACE_X, height - SB_BUTTON_BOTH_HEIGHT + SB_BEVEL_WIDTH_UPPER_LEFT); - s = (scrollbar_isDn()) ? R->h->downArrowHi : R->h->downArrow; - XCopyArea(R->Xdisplay, s, R->scrollBar.win, R->h->whiteGC, 0, 0, + s = (scrollbar_isDn()) ? downArrowHi : downArrow; + XCopyArea(Xdisplay, s, scrollBar.win, whiteGC, 0, 0, ARROW_WIDTH, ARROW_HEIGHT, SB_BUTTON_FACE_X, height - SB_BUTTON_SINGLE_HEIGHT + SB_BEVEL_WIDTH_UPPER_LEFT); }