ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/scrollbar.C
(Generate patch)

Comparing rxvt-unicode/src/scrollbar.C (file contents):
Revision 1.48 by ayin, Sun Jan 27 22:48:33 2008 UTC vs.
Revision 1.53 by ayin, Sun Feb 17 12:11:56 2008 UTC

36{ 36{
37 int change = 0; 37 int change = 0;
38 38
39 if (map) 39 if (map)
40 { 40 {
41 scrollBar.setIdle (); 41 scrollBar.state = STATE_IDLE;
42 42
43 if (!scrollBar.win) 43 if (!scrollBar.win)
44 resize_scrollbar (); 44 resize_scrollbar ();
45 45
46 if (scrollBar.win) 46 if (scrollBar.win)
110 { 110 {
111 /* create the scrollbar window */ 111 /* create the scrollbar window */
112 scrollBar.win = XCreateSimpleWindow (dpy, 112 scrollBar.win = XCreateSimpleWindow (dpy,
113 parent[0], 113 parent[0],
114 window_sb_x, 0, 114 window_sb_x, 0,
115 scrollbar_TotalWidth (), 115 scrollBar.total_width (),
116 szHint.height, 116 szHint.height,
117 0, 117 0,
118 pix_colors[Color_fg], 118 pix_colors[Color_fg],
119 pix_colors[Color_border]); 119 pix_colors[Color_border]);
120 XDefineCursor (dpy, scrollBar.win, scrollBar.leftptr_cursor); 120 XDefineCursor (dpy, scrollBar.win, scrollBar.leftptr_cursor);
149 if (update) 149 if (update)
150 { 150 {
151 top = view_start - top_row; 151 top = view_start - top_row;
152 bot = top + (nrow - 1); 152 bot = top + (nrow - 1);
153 len = max (nrow - 1 - top_row, 1); 153 len = max (nrow - 1 - top_row, 1);
154 adj = (((bot - top) * scrollbar_size ()) % len) > 0 ? 1 : 0; 154 adj = (((bot - top) * scrollBar.size ()) % len) > 0 ? 1 : 0;
155 155
156 scrollBar.top = (scrollBar.beg + (top * scrollbar_size ()) / len); 156 scrollBar.top = (scrollBar.beg + (top * scrollBar.size ()) / len);
157 scrollBar.len = ((bot - top) * scrollbar_size ()) / len + 157 scrollBar.len = ((bot - top) * scrollBar.size ()) / len +
158 scrollbar_minheight () + adj; 158 scrollBar.min_height () + adj;
159 scrollBar.bot = (scrollBar.top + scrollBar.len); 159 scrollBar.bot = (scrollBar.top + scrollBar.len);
160 /* no change */ 160 /* no change */
161 if (scrollBar.top == scrollBar.last_top 161 if (scrollBar.top == scrollBar.last_top
162 && scrollBar.bot == scrollBar.last_bot 162 && scrollBar.bot == scrollBar.last_bot
163 && (scrollBar.state == scrollBar.last_state || !scrollbar_isUpDn ())) 163 && (scrollBar.state == scrollBar.last_state
164 || !(scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN)))
164 return 0; 165 return 0;
165 } 166 }
166 167
167 ret = (this->*scrollBar.update) (update, scrollBar.last_top, scrollBar.last_bot, scrollBar.len); 168 ret = (this->*scrollBar.update) (update, scrollBar.last_top, scrollBar.last_bot, scrollBar.len);
168 169
172 173
173 return ret; 174 return ret;
174} 175}
175 176
176void 177void
177rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, const char *thickness) 178scrollBar_t::setup (rxvt_term *term)
178{ 179{
179 int i; 180 int i;
180 short style, width; 181 short style, width;
182 const char *scrollalign, *scrollstyle, *thickness;
183
184 this->term = term;
185 scrollalign = term->rs[Rs_scrollBar_align];
186 scrollstyle = term->rs[Rs_scrollstyle];
187 thickness = term->rs[Rs_scrollBar_thickness];
181 188
182# if defined(RXVT_SCROLLBAR) 189# if defined(RXVT_SCROLLBAR)
183 style = R_SB_RXVT; 190 style = R_SB_RXVT;
184# elif defined(XTERM_SCROLLBAR) 191# elif defined(XTERM_SCROLLBAR)
185 style = R_SB_XTERM; 192 style = R_SB_XTERM;
221 if (style != R_SB_NEXT) /* dishonour request - for now */ 228 if (style != R_SB_NEXT) /* dishonour request - for now */
222 if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM) 229 if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM)
223 width = min (i, SB_WIDTH_MAXIMUM); 230 width = min (i, SB_WIDTH_MAXIMUM);
224 231
225# ifdef RXVT_SCROLLBAR 232# ifdef RXVT_SCROLLBAR
226 if (! option (Opt_scrollBar_floating) && style == R_SB_RXVT) 233 if (! term->option (Opt_scrollBar_floating) && style == R_SB_RXVT)
227 scrollBar.shadow = SHADOW_WIDTH; 234 shadow = SHADOW_WIDTH;
228# endif 235# endif
229 236
230 scrollBar.style = style; 237 this->style = style;
231 scrollBar.width = width; 238 this->width = width;
232 239
233 /* scrollBar.align = R_SB_ALIGN_CENTRE; */ 240 /* align = R_SB_ALIGN_CENTRE; */
234 if (scrollalign) 241 if (scrollalign)
235 { 242 {
236 if (strncasecmp (scrollalign, "top", 3) == 0) 243 if (strncasecmp (scrollalign, "top", 3) == 0)
237 scrollBar.align = R_SB_ALIGN_TOP; 244 align = R_SB_ALIGN_TOP;
238 else if (strncasecmp (scrollalign, "bottom", 6) == 0) 245 else if (strncasecmp (scrollalign, "bottom", 6) == 0)
239 scrollBar.align = R_SB_ALIGN_BOTTOM; 246 align = R_SB_ALIGN_BOTTOM;
240 } 247 }
241 scrollBar.last_bot = scrollBar.last_state = -1; 248 last_bot = last_state = -1;
242 /* cursor scrollBar: Black-on-White */ 249 /* cursor scrollBar: Black-on-White */
243 scrollBar.leftptr_cursor = XCreateFontCursor (dpy, XC_left_ptr); 250 leftptr_cursor = XCreateFontCursor (term->dpy, XC_left_ptr);
244} 251}
245 252
246/*----------------------- end-of-file (C source) -----------------------*/ 253/*----------------------- end-of-file (C source) -----------------------*/
247 254

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines