📄 scrollbar-sgi.c
字号:
/*--------------------------------*-C-*---------------------------------* * File: scrollbar-sgi.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> * Copyright (c) 1998 Sasha Vasko * Copyright (c) 2000 Frank Everdij <frank@ff-net.demon.nl> * Copyright (c) 2004 Jingmin Zhou <jimmyzhou@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/#include "../config.h"#include "rxvt.h"/*----------------------------------------------------------------------*/#ifdef HAVE_SCROLLBARS#ifdef SGI_SCROLLBAR#define CHOOSE_GC_FG(R, PIXCOL) \ XSetForeground ((R)->Xdisplay, (R)->scrollBar.gc, (PIXCOL))static char *SCROLLER_DIMPLE[] = { " ", "############", ".==========%", ".==========%", " ", "############", ".==========%", ".==========%", " ", "############"};#define SCROLLER_DIMPLE_WIDTH 12#define SCROLLER_DIMPLE_HEIGHT 10static char *SCROLLER_ARROW_UP[] = { "============", "============", "=====*======", "=====**=====", "=====**=====", "====****====", "====****====", "===******===", "===******===", "==********==", "==********==", "============", "============", "============"};static char *SCROLLER_ARROW_DOWN[] = { "============", "============", "=*********==", "==********==", "==********==", "===******===", "===******===", "====****====", "====****====", "=====**=====", "=====**=====", "============", "============", "============"};static char *LO_SCROLLER_ARROW_UP[] = { "============", "============", "=====-======", "=====--=====", "=====--=====", "====----====", "====----====", "===------===", "===------===", "==--------==", "==--------==", "============", "============", "============"};static char *LO_SCROLLER_ARROW_DOWN[] = { "============", "============", "=---------==", "==--------==", "==--------==", "===------===", "===------===", "====----====", "====----====", "=====--=====", "=====--=====", "============", "============", "============"};static char *HI_SCROLLER_ARROW_UP[] = { " ", " ", " % ", " %% ", " %% ", " %%%% ", " %%%% ", " %%%%%% ", " %%%%%% ", " %%%%%%%% ", " %%%%%%%% ", " ", " ", " "};static char *HI_SCROLLER_ARROW_DOWN[] = { " ", " ", " %%%%%%%%% ", " %%%%%%%% ", " %%%%%%%% ", " %%%%%% ", " %%%%%% ", " %%%% ", " %%%% ", " %% ", " %% ", " ", " ", " "};#define ARROW_SOURCE_WIDTH 12#define ARROW_SOURCE_HEIGHT 14#ifndef SCROLL_SHADOW_HEIGHT# define SCROLL_SHADOW_HEIGHT 1#endif/* end unconfigurable stuff */#define stp_width 8#define stp_height 8static unsigned char stp_bits[] = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa};/* INTPROTO */static Pixmapcreate_icon (rxvt_t* r, char **data, int sx, int sy, unsigned int width, unsigned int height){ register int i, k; register int x, y; unsigned long pixel; Pixmap pixmap; pixmap = XCreatePixmap (r->Xdisplay, r->scrollBar.win, width, height, XDEPTH); if (NOT_PIXMAP(pixmap)) return None; y = sy; for (i = 0; i < height ; y++, i++ ) { x = sx ; for (k = 0; k < width ; k++, x++ ) { switch (data[y][x]) { case ' ': case 'w': pixel = r->scrollBar.sgi_white; break; case '.': case 'l': pixel = r->scrollBar.sgi_fg; break; case '-': case 'g': pixel = r->scrollBar.sgi_lmedium; break; case '%': case 'd': pixel = r->scrollBar.sgi_dark; break; case '*': case 'v': pixel = r->scrollBar.sgi_vdark; break; case '#': case 'b': pixel = r->scrollBar.sgi_black; break; case '=': case 'm': default: pixel = r->scrollBar.sgi_bg; break; } CHOOSE_GC_FG(r, pixel); XDrawPoint (r->Xdisplay, pixmap, r->scrollBar.gc, k, i); } } return (pixmap);}/* Draw bevel & arrows *//* INTPROTO */static voidsgi_draw_bevel (rxvt_t* r, Drawable d, int x, int y, int w, int h){ CHOOSE_GC_FG(r, r->scrollBar.sgi_fg); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x, y, x+w, y); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x, y, x, y+h); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+1, y+1, x+w-1, y+1); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+1, y+1, x+1, y+h-1); CHOOSE_GC_FG(r, r->scrollBar.sgi_dark); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+w, y+1, x+w, y+h); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+1, y+h, x+w, y+h); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+w-1, y+2, x+w-1, y+h-1); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+2, y+h-1, x+w-1, y+h-1);}/* INTPROTO */static voidscrollbar_fill_back (rxvt_t* r, unsigned int height){ /* fill background */ XClearArea (r->Xdisplay, r->scrollBar.win, 0, SGI_SB_BUTTON_HEIGHT, SB_WIDTH_SGI, height, False); /* fill top button space */ CHOOSE_GC_FG(r, r->scrollBar.sgi_fg); XFillRectangle (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 0, 0, SB_WIDTH_SGI, SGI_SB_BUTTON_HEIGHT); /* fill bottom button space */ XFillRectangle (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 0, height+SGI_SB_BUTTON_HEIGHT, SB_WIDTH_SGI, SGI_SB_BUTTON_HEIGHT); CHOOSE_GC_FG(r, r->scrollBar.sgi_dark); /* right vertical border line */ XDrawLine (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, SB_WIDTH_SGI-1, 0, SB_WIDTH_SGI-1, height+SGI_SB_BUTTONS_HEIGHT); /* bottom horizontal line */ XDrawLine (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 2, height+SGI_SB_BUTTONS_HEIGHT-1, SB_WIDTH_SGI, height+SGI_SB_BUTTONS_HEIGHT-1);}/* EXTPROTO */void rxvt_scrollbar_init_sgi (rxvt_t* r){ XGCValues gcvalue;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -