annotate src/scrollbar.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 501cfd01ee6d
children 95016f13131a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Generic scrollbar implementation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 /* This file has been Mule-ized. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include "buffer.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include "commands.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "scrollbar.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include "device.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "frame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "glyphs.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 Lisp_Object Qinit_scrollbar_from_resources;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 Lisp_Object Qscrollbar_line_up;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 Lisp_Object Qscrollbar_line_down;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 Lisp_Object Qscrollbar_page_up;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 Lisp_Object Qscrollbar_page_down;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 Lisp_Object Qscrollbar_to_top;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 Lisp_Object Qscrollbar_to_bottom;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 Lisp_Object Qscrollbar_vertical_drag;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 Lisp_Object Qscrollbar_char_left;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 Lisp_Object Qscrollbar_char_right;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 Lisp_Object Qscrollbar_page_left;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 Lisp_Object Qscrollbar_page_right;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 Lisp_Object Qscrollbar_to_left;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 Lisp_Object Qscrollbar_to_right;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 Lisp_Object Qscrollbar_horizontal_drag;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 #define DEFAULT_SCROLLBAR_WIDTH 15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 #define DEFAULT_SCROLLBAR_HEIGHT 15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
60 /* Width and height of the scrollbar. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 Lisp_Object Vscrollbar_width;
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
62 Lisp_Object Vscrollbar_height;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
64 /* Scrollbar visibility specifiers */
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
65 Lisp_Object Vhorizontal_scrollbar_visible_p;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
66 Lisp_Object Vvertical_scrollbar_visible_p;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
67
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
68 /* Scrollbar location specifiers */
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
69 Lisp_Object Vscrollbar_on_left_p;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
70 Lisp_Object Vscrollbar_on_top_p;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 Lisp_Object Vscrollbar_pointer_glyph;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
74 EXFUN (Fcenter_to_window_line, 2);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
75
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 static void update_scrollbar_instance (struct window *w, int vertical,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 struct scrollbar_instance *instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 free_scrollbar_instance (struct scrollbar_instance *instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 struct frame *frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 if (!instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 struct device *d = XDEVICE (frame->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 MAYBE_DEVMETH (d, free_scrollbar_instance, (instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 xfree (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 free_window_mirror_scrollbars (struct window_mirror *mir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 {
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
98 free_scrollbar_instance (mir->scrollbar_vertical_instance, mir->frame);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 mir->scrollbar_vertical_instance = 0;
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
100
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
101 free_scrollbar_instance (mir->scrollbar_horizontal_instance, mir->frame);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 mir->scrollbar_horizontal_instance = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 static struct window_mirror *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 free_scrollbars_loop (Lisp_Object window, struct window_mirror *mir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 struct window_mirror *retval = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 while (mir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 assert (!NILP (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 if (mir->vchild)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 retval = free_scrollbars_loop (XWINDOW (window)->vchild,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 mir->vchild);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 else if (mir->hchild)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 retval = free_scrollbars_loop (XWINDOW (window)->hchild,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 mir->hchild);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 if (retval != NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 return retval;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
128 if (mir->scrollbar_vertical_instance ||
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
129 mir->scrollbar_horizontal_instance)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 free_window_mirror_scrollbars (mir);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 mir = mir->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 window = XWINDOW (window)->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 /* Destroy all scrollbars associated with FRAME. Only called from
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
140 delete_frame_internal. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 free_frame_scrollbars (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 if (!HAS_FRAMEMETH_P (f, create_scrollbar_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 if (f->mirror_dirty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 update_frame_window_mirror (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 free_scrollbars_loop (f->root_window, f->root_mirror);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
152 while (FRAME_SB_VCACHE (f))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
153 {
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
154 struct scrollbar_instance *tofree = FRAME_SB_VCACHE (f);
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
155 FRAME_SB_VCACHE (f) = FRAME_SB_VCACHE (f)->next;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
156 tofree->next = NULL;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
157 free_scrollbar_instance (tofree, f);
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
158 }
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
159
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
160 while (FRAME_SB_HCACHE (f))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
161 {
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
162 struct scrollbar_instance *tofree = FRAME_SB_HCACHE (f);
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
163 FRAME_SB_HCACHE (f) = FRAME_SB_HCACHE (f)->next;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
164 tofree->next = NULL;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
165 free_scrollbar_instance (tofree, f);
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
166 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 static struct scrollbar_instance *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 create_scrollbar_instance (struct frame *f, int vertical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 struct scrollbar_instance *instance =
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 102
diff changeset
175 xnew_and_zero (struct scrollbar_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 MAYBE_DEVMETH (d, create_scrollbar_instance, (f, vertical, instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 return instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 #define GET_SCROLLBAR_INSTANCE_INTERNAL(cache) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 if (FRAME_SB_##cache (f)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 struct scrollbar_instance *retval = FRAME_SB_##cache (f); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 FRAME_SB_##cache (f) = FRAME_SB_##cache (f)->next; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 retval->next = NULL; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 return retval; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 } \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 static struct scrollbar_instance *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 get_scrollbar_instance (struct frame *f, int vertical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 /* Check if there are any available scrollbars already in existence. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 if (vertical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 GET_SCROLLBAR_INSTANCE_INTERNAL (VCACHE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 GET_SCROLLBAR_INSTANCE_INTERNAL (HCACHE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 return create_scrollbar_instance (f, vertical);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 #undef GET_SCROLLBAR_INSTANCE_INTERNAL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 #define RELEASE_SCROLLBAR_INSTANCE_INTERNAL(cache) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 if (!FRAME_SB_##cache (f)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 instance->next = NULL; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 FRAME_SB_##cache (f) = instance; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 } \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 else \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 instance->next = FRAME_SB_##cache (f); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 FRAME_SB_##cache (f) = instance; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 } \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 release_scrollbar_instance (struct frame *f, int vertical,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 struct scrollbar_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 /* #### should we do "instance->mir = 0;" for safety? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 if (vertical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 RELEASE_SCROLLBAR_INSTANCE_INTERNAL (VCACHE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 RELEASE_SCROLLBAR_INSTANCE_INTERNAL (HCACHE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 #undef RELEASE_SCROLLBAR_INSTANCE_INTERNAL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 #ifdef MEMORY_USAGE_STATS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 compute_scrollbar_instance_usage (struct device *d,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 struct scrollbar_instance *inst,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 struct overhead_stats *ovstats)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 int total = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 total += DEVMETH (d, compute_scrollbar_instance_usage, (d, inst, ovstats));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 while (inst)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 total += malloced_storage_size (inst, sizeof (*inst), ovstats);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 inst = inst->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 return total;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 #endif /* MEMORY_USAGE_STATS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 update_window_scrollbars (struct window *w, struct window_mirror *mirror,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 int active, int horiz_only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 if (!HAS_DEVMETH_P (d, create_scrollbar_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 in_display++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 /* It is possible for this to get called from the mirror update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 routines. In that case the structure is in an indeterminate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 state but we know exactly what struct we are working with. So we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 pass it in in that case. We also take advantage of it at some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 other points where we know what the mirror struct is. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 if (!mirror)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 mirror = find_window_mirror (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 if (!mirror->scrollbar_vertical_instance && active)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 mirror->scrollbar_vertical_instance = get_scrollbar_instance (f, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 if (!mirror->scrollbar_horizontal_instance && active)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 mirror->scrollbar_horizontal_instance = get_scrollbar_instance (f, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 if (!horiz_only && mirror->scrollbar_vertical_instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 int size = (active ? window_scrollbar_width (w) : 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 struct scrollbar_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 instance = mirror->scrollbar_vertical_instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 instance->scrollbar_is_active = active;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 instance->mirror = mirror;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 if (active && size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 update_scrollbar_instance (w, 1, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 MAYBE_DEVMETH (d, update_scrollbar_instance_status,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (w, active, size, instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 if (!active)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 release_scrollbar_instance (f, 1, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 mirror->scrollbar_vertical_instance = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 if (mirror->scrollbar_horizontal_instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 int size = (active ? window_scrollbar_height (w) : 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 struct scrollbar_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 instance = mirror->scrollbar_horizontal_instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 instance->scrollbar_is_active = active;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 instance->mirror = mirror;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 if (active && size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 update_scrollbar_instance (w, 0, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 MAYBE_DEVMETH (d, update_scrollbar_instance_status,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (w, active, size, instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 if (!active)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 release_scrollbar_instance (f, 0, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 mirror->scrollbar_horizontal_instance = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 in_display--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 release_window_mirror_scrollbars (struct window_mirror *mir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 struct device *d = XDEVICE (mir->frame->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 if (!HAS_DEVMETH_P (d, create_scrollbar_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 if (mir->scrollbar_vertical_instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 release_scrollbar_instance (mir->frame, 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 mir->scrollbar_vertical_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 MAYBE_DEVMETH (d, release_scrollbar_instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (mir->scrollbar_vertical_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 mir->scrollbar_vertical_instance = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 if (mir->scrollbar_horizontal_instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 release_scrollbar_instance (mir->frame, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 mir->scrollbar_horizontal_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 MAYBE_DEVMETH (d, release_scrollbar_instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (mir->scrollbar_horizontal_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 mir->scrollbar_horizontal_instance = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 * If w->sb_point is on the top line then return w->sb_point else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 * return w->start. If flag, then return beginning point of line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 * which w->sb_point lies on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 static Bufpos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 scrollbar_point (struct window *w, int flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 Bufpos start_pos, end_pos, sb_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 Lisp_Object buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 struct buffer *b;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 if (NILP (w->buffer)) /* non-leaf window */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 start_pos = marker_position (w->start[CURRENT_DISP]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 sb_pos = marker_position (w->sb_point);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 if (!flag && sb_pos < start_pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 return start_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 buf = get_buffer (w->buffer, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 if (!NILP (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 b = XBUFFER (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 return start_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 if (flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 end_pos = find_next_newline_no_quit (b, sb_pos, -1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 end_pos = find_next_newline_no_quit (b, start_pos, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 if (flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 return end_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 else if (sb_pos > end_pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 return start_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 return sb_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 * Update a window's horizontal or vertical scrollbar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 update_scrollbar_instance (struct window *w, int vertical,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 struct scrollbar_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 struct buffer *b = XBUFFER (w->buffer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 Bufpos start_pos, end_pos, sb_pos;
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
404 int scrollbar_width = window_scrollbar_width (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 int scrollbar_height = window_scrollbar_height (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 int new_line_increment = -1, new_page_increment = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 int new_minimum = -1, new_maximum = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 int new_slider_size = -1, new_slider_position = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 int new_width = -1, new_height = -1, new_x = -1, new_y = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 struct window *new_window = 0; /* kludge city */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 end_pos = BUF_Z (b) - w->window_end_pos[CURRENT_DISP];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 sb_pos = scrollbar_point (w, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 start_pos = sb_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 /* The end position must be strictly greater than the start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 position, at least for the Motify scrollbar. It shouldn't hurt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 anything for other scrollbar implementations. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 if (end_pos <= start_pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 end_pos = start_pos + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 if (vertical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 new_height = WINDOW_TEXT_HEIGHT (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 new_width = scrollbar_width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 new_height = scrollbar_height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 new_width = WINDOW_TEXT_WIDTH (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 /* If the height and width are not greater than 0, then later on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 Motif widgets will bitch and moan. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 if (new_height <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 new_height = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 if (new_width <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 new_width = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 assert (instance->mirror && XWINDOW (real_window(instance->mirror, 0)) == w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 /* Only character-based scrollbars are implemented at the moment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 Line-based will be implemented in the future. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 instance->scrollbar_is_active = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 new_line_increment = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 new_page_increment = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
450 /* We used to check for inhibit_scrollbar_slider_size_change here,
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
451 but that seems bogus. */
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
452 {
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
453 int x_offset, y_offset;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
455 /* Scrollbars are always the farthest from the text area. */
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
456 if (vertical)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
457 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
458 x_offset = (!NILP (w->scrollbar_on_left_p)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
459 ? WINDOW_LEFT (w)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
460 : (WINDOW_RIGHT (w) - scrollbar_width
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
461 - (window_needs_vertical_divider (w)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
462 ? window_divider_width (w) : 0)));
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
463 y_offset = WINDOW_TEXT_TOP (w) + f->scrollbar_y_offset;
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
464 }
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
465 else
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
466 {
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
467 x_offset = WINDOW_TEXT_LEFT (w);
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
468 y_offset = f->scrollbar_y_offset +
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
469 (!NILP (w->scrollbar_on_top_p)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
470 ? WINDOW_TOP (w)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
471 : WINDOW_TEXT_BOTTOM (w) + window_bottom_toolbar_height (w));
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
472 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
474 new_x = x_offset;
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
475 new_y = y_offset;
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
476 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 /* A disabled scrollbar has its slider sized to the entire height of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 the scrollbar. Currently the minibuffer scrollbar is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 disabled. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 if (!MINI_WINDOW_P (w) && vertical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 {
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
483 if (!DEVMETH_OR_GIVEN (d, inhibit_scrollbar_slider_size_change, (), 0))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 new_minimum = BUF_BEGV (b);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 new_maximum = max (BUF_ZV (b), new_minimum + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 new_slider_size = min ((end_pos - start_pos),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (new_maximum - new_minimum));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 new_slider_position = sb_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 new_window = w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 else if (!MINI_WINDOW_P (w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 /* The minus one is to account for the truncation glyph. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 int wcw = window_char_width (w, 0) - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 int max_width, max_slide;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 if (w->max_line_len < wcw)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 max_width = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 max_slide = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 wcw = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 max_width = w->max_line_len + 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 max_slide = max_width - wcw;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 new_minimum = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 new_maximum = max_width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 new_slider_size = wcw;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 new_slider_position = min (w->hscroll, max_slide);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 }
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
516 else /* MINI_WINDOW_P (w) */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 new_minimum = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 new_maximum = 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 new_slider_size = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 new_slider_position = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 instance->scrollbar_is_active = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 DEVMETH (d, update_scrollbar_instance_values, (w, instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 new_line_increment,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 new_page_increment,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 new_minimum,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 new_maximum,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 new_slider_size,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 new_slider_position,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 new_width, new_height,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 new_x, new_y));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 init_frame_scrollbars (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 if (HAS_DEVMETH_P (d, create_scrollbar_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 {
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
543 int depth = unlock_ghost_specifiers_protected ();
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 227
diff changeset
544 Lisp_Object frame;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 XSETFRAME (frame, f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 call_critical_lisp_code (XDEVICE (FRAME_DEVICE (f)),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 Qinit_scrollbar_from_resources,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 frame);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
549 unbind_to (depth, Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 init_device_scrollbars (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 if (HAS_DEVMETH_P (d, create_scrollbar_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 {
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
558 int depth = unlock_ghost_specifiers_protected ();
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 227
diff changeset
559 Lisp_Object device;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 XSETDEVICE (device, d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 call_critical_lisp_code (d,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 Qinit_scrollbar_from_resources,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 device);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
564 unbind_to (depth, Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 init_global_scrollbars (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 if (HAS_DEVMETH_P (d, create_scrollbar_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 {
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
573 int depth = unlock_ghost_specifiers_protected ();
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 call_critical_lisp_code (d,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 Qinit_scrollbar_from_resources,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 Qglobal);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
577 unbind_to (depth, Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
581 static void
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
582 vertical_scrollbar_changed_in_window (Lisp_Object specifier,
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
583 struct window *w,
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
584 Lisp_Object oldval)
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
585 {
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
586 /* Hold on your cerebella guys. If we always show the dividers,
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
587 changing scrollbar affects only how the text and scrollbar are
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
588 laid out in the window. If we do not want the dividers to show up
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
589 always, then we mark more drastic change, because changing
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
590 divider appearance changes lotta things. Although we actually need
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
591 to do this only if the scrollbar has appeared or disappeared
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
592 completely at either window edge, we do this always, as users
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
593 usually do not reposition scrollbars 200 times a second or so. Do
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
594 you? */
298
70ad99077275 Import from CVS: tag r21-0b47
cvs
parents: 284
diff changeset
595 if (NILP (w->vertical_divider_always_visible_p))
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
596 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (XFRAME (WINDOW_FRAME (w)));
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
597 else
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
598 MARK_WINDOWS_CHANGED (w);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
599 }
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
600
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 /* This function is called as a result of a change to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 `scrollbar-pointer' glyph. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 scrollbar_pointer_changed_in_window (Lisp_Object specifier, struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 Lisp_Object oldval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 struct frame *f = XFRAME (WINDOW_FRAME (w));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 if (f->init_finished)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 MAYBE_FRAMEMETH (f, scrollbar_pointer_changed_in_window, (w));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 /* ####
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 All of the following stuff is functions that handle scrollbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 actions. All of it should be moved into Lisp. This may require
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 adding some badly-needed primitives. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 /********** vertical scrollbar stuff **********/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 * If the original point is still visible, put the cursor back there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 * Otherwise, when scrolling down stick it at the beginning of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 * first visible line and when scrolling up stick it at the beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 * of the last visible line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 /* #### This function should be moved into Lisp */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 scrollbar_reset_cursor (Lisp_Object win, Lisp_Object orig_pt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 /* When this function is called we know that start is already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 accurate. We know this because either set-window-start or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 recenter was called immediately prior to it being called. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 Lisp_Object buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 Bufpos start_pos = XINT (Fwindow_start (win));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 Bufpos ptint = XINT (orig_pt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 struct window *w = XWINDOW (win);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 int selected = ((w == XWINDOW (Fselected_window (XFRAME (w->frame)->device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 ? 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 : 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 buf = Fwindow_buffer (win);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 if (NILP (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 return; /* the window was deleted out from under us */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 if (ptint < XINT (Fwindow_start (win)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 if (selected)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 Fgoto_char (make_int (start_pos), buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 Fset_window_point (win, make_int (start_pos));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 else if (!point_would_be_visible (XWINDOW (win), start_pos, ptint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 Fmove_to_window_line (make_int (-1), win);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 if (selected)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 Fbeginning_of_line (Qnil, buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 /* #### Taken from forward-line. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 Bufpos pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 pos = find_next_newline (XBUFFER (buf),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 marker_position (w->pointm[CURRENT_DISP]),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 -1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 Fset_window_point (win, make_int (pos));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 if (selected)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 Fgoto_char (orig_pt, buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 Fset_window_point (win, orig_pt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
680 DEFUN ("scrollbar-line-up", Fscrollbar_line_up, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 Function called when the line-up arrow on the scrollbar is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 This is the little arrow at the top of the scrollbar. One argument, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 scrollbar's window. You can advise this function to change the scrollbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 behavior.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
685 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
686 (window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 CHECK_LIVE_WINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 window_scroll (window, make_int (1), -1, ERROR_ME_NOT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 zmacs_region_stays = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
694 DEFUN ("scrollbar-line-down", Fscrollbar_line_down, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 Function called when the line-down arrow on the scrollbar is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 This is the little arrow at the bottom of the scrollbar. One argument, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 scrollbar's window. You can advise this function to change the scrollbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 behavior.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
699 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
700 (window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 CHECK_LIVE_WINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 window_scroll (window, make_int (1), 1, ERROR_ME_NOT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 zmacs_region_stays = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
708 DEFUN ("scrollbar-page-up", Fscrollbar_page_up, 1, 1, 0, /*
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 102
diff changeset
709 Function called when the user gives the "page-up" scrollbar action.
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 227
diff changeset
710 \(The way this is done can vary from scrollbar to scrollbar.) One argument,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 a cons containing the scrollbar's window and a value (#### document me!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 This value is nil for Motif/Lucid scrollbars and a number for Athena
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 scrollbars). You can advise this function to change the scrollbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 behavior.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
715 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
716 (object))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 Lisp_Object window = Fcar (object);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 CHECK_LIVE_WINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 /* Motif and Athena scrollbars behave differently, but in accordance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 with their standard behaviors. It is not possible to hide the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 differences down in lwlib because knowledge of XEmacs buffer and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 cursor motion routines is necessary. */
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
725 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
726 defined (LWLIB_SCROLLBARS_ATHENA3D) || defined(HAVE_MS_WINDOWS)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
727 window_scroll (window, Qnil, -1, ERROR_ME_NOT);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
728 #else /* Athena */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
729 {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
730 Bufpos bufpos;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
731 Lisp_Object value = Fcdr (object);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
733 CHECK_INT (value);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
734 Fmove_to_window_line (Qzero, window);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
735 /* can't use Fvertical_motion() because it moves the buffer point
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
736 rather than the window's point.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
738 #### It does? Why does it take a window argument then? */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
739 bufpos = vmotion (XWINDOW (window), XINT (Fwindow_point (window)),
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
740 XINT (value), 0);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
741 Fset_window_point (window, make_int (bufpos));
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
742 Fcenter_to_window_line (Qzero, window);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
743 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
744 #endif /* Athena */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 zmacs_region_stays = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
749 DEFUN ("scrollbar-page-down", Fscrollbar_page_down, 1, 1, 0, /*
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 102
diff changeset
750 Function called when the user gives the "page-down" scrollbar action.
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 227
diff changeset
751 \(The way this is done can vary from scrollbar to scrollbar.) One argument,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 a cons containing the scrollbar's window and a value (#### document me!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 This value is nil for Motif/Lucid scrollbars and a number for Athena
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 scrollbars). You can advise this function to change the scrollbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 behavior.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
756 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
757 (object))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 Lisp_Object window = Fcar (object);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 CHECK_LIVE_WINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 /* Motif and Athena scrollbars behave differently, but in accordance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 with their standard behaviors. It is not possible to hide the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 differences down in lwlib because knowledge of XEmacs buffer and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 cursor motion routines is necessary. */
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
766 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
767 defined (LWLIB_SCROLLBARS_ATHENA3D) || defined (HAVE_MS_WINDOWS)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
768 window_scroll (window, Qnil, 1, ERROR_ME_NOT);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
769 #else /* Athena */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
770 {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
771 Lisp_Object value = Fcdr (object);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
772 CHECK_INT (value);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
773 Fmove_to_window_line (value, window);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
774 Fcenter_to_window_line (Qzero, window);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
775 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
776 #endif /* Athena */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 zmacs_region_stays = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
781 DEFUN ("scrollbar-to-top", Fscrollbar_to_top, 1, 1, 0, /*
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 102
diff changeset
782 Function called when the user invokes the "to-top" scrollbar action.
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
783 The way this is done can vary from scrollbar to scrollbar, but
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
784 C-button1 on the up-arrow is very common. One argument, the
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
785 scrollbar's window. You can advise this function to change the
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 scrollbar behavior.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
787 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
788 (window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 {
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
790 Lisp_Object orig_pt = Fwindow_point (window);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 Fset_window_point (window, Fpoint_min (Fwindow_buffer (window)));
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
792 Fcenter_to_window_line (Qzero, window);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 scrollbar_reset_cursor (window, orig_pt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 zmacs_region_stays = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
798 DEFUN ("scrollbar-to-bottom", Fscrollbar_to_bottom, 1, 1, 0, /*
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 102
diff changeset
799 Function called when the user invokes the "to-bottom" scrollbar action.
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
800 The way this is done can vary from scrollbar to scrollbar, but
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
801 C-button1 on the down-arrow is very common. One argument, the
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
802 scrollbar's window. You can advise this function to change the
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 scrollbar behavior.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
804 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
805 (window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 {
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
807 Lisp_Object orig_pt = Fwindow_point (window);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 Fset_window_point (window, Fpoint_max (Fwindow_buffer (window)));
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
809 Fcenter_to_window_line (make_int (-3), window);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 scrollbar_reset_cursor (window, orig_pt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 zmacs_region_stays = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
815 DEFUN ("scrollbar-vertical-drag", Fscrollbar_vertical_drag, 1, 1, 0, /*
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
816 Function called when the user drags the vertical scrollbar slider.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 One argument, a cons containing the scrollbar's window and a value
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
818 between point-min and point-max. You can advise this function to
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
819 change the scrollbar behavior.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
820 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
821 (object))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 Bufpos start_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 Lisp_Object orig_pt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 Lisp_Object window = Fcar (object);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 Lisp_Object value = Fcdr (object);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 orig_pt = Fwindow_point (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 Fset_marker (XWINDOW (window)->sb_point, value, Fwindow_buffer (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 start_pos = scrollbar_point (XWINDOW (window), 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 Fset_window_start (window, make_int (start_pos), Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 scrollbar_reset_cursor (window, orig_pt);
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
833 Fsit_for(Qzero, Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 zmacs_region_stays = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
838 DEFUN ("scrollbar-set-hscroll", Fscrollbar_set_hscroll, 2, 2, 0, /*
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 227
diff changeset
839 Set WINDOW's hscroll position to VALUE.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 This ensures that VALUE is in the proper range for the horizontal scrollbar.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
841 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
842 (window, value))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 struct window *w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 int hscroll, wcw, max_len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 CHECK_LIVE_WINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 if (!EQ (value, Qmax))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 CHECK_INT (value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 w = XWINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 wcw = window_char_width (w, 0) - 1;
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
853 /* ### We should be able to scroll further right as long as there is
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
854 a visible truncation glyph. This calculation for max is bogus. */
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 82
diff changeset
855 max_len = w->max_line_len + 2;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 if (EQ (value, Qmax) || (XINT (value) > (max_len - wcw)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 hscroll = max_len - wcw;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 hscroll = XINT (value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 /* Can't allow this out of set-window-hscroll's acceptable range. */
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
863 /* #### What hell on the earth this code limits scroll size to the
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
864 machine-dependent SHORT size? -- kkm */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 if (hscroll < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 hscroll = 0;
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
867 else if (hscroll >= (1 << (SHORTBITS - 1)) - 1)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 hscroll = (1 << (SHORTBITS - 1)) - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 if (hscroll != w->hscroll)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 Fset_window_hscroll (window, make_int (hscroll));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 syms_of_scrollbar (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 defsymbol (&Qscrollbar_line_up, "scrollbar-line-up");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 defsymbol (&Qscrollbar_line_down, "scrollbar-line-down");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 defsymbol (&Qscrollbar_page_up, "scrollbar-page-up");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 defsymbol (&Qscrollbar_page_down, "scrollbar-page-down");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 defsymbol (&Qscrollbar_to_top, "scrollbar-to-top");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 defsymbol (&Qscrollbar_to_bottom, "scrollbar-to-bottom");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 defsymbol (&Qscrollbar_vertical_drag, "scrollbar-vertical-drag");
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 102
diff changeset
891
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 defsymbol (&Qscrollbar_char_left, "scrollbar-char-left");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 defsymbol (&Qscrollbar_char_right, "scrollbar-char-right");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 defsymbol (&Qscrollbar_page_left, "scrollbar-page-left");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 defsymbol (&Qscrollbar_page_right, "scrollbar-page-right");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 defsymbol (&Qscrollbar_to_left, "scrollbar-to-left");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 defsymbol (&Qscrollbar_to_right, "scrollbar-to-right");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 defsymbol (&Qscrollbar_horizontal_drag, "scrollbar-horizontal-drag");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 defsymbol (&Qinit_scrollbar_from_resources, "init-scrollbar-from-resources");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 /* #### All these functions should be moved into Lisp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 See comment above. */
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
904 DEFSUBR (Fscrollbar_line_up);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
905 DEFSUBR (Fscrollbar_line_down);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
906 DEFSUBR (Fscrollbar_page_up);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
907 DEFSUBR (Fscrollbar_page_down);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
908 DEFSUBR (Fscrollbar_to_top);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
909 DEFSUBR (Fscrollbar_to_bottom);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
910 DEFSUBR (Fscrollbar_vertical_drag);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
912 DEFSUBR (Fscrollbar_set_hscroll);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 vars_of_scrollbar (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 DEFVAR_LISP ("scrollbar-pointer-glyph", &Vscrollbar_pointer_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 *The shape of the mouse-pointer when over a scrollbar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 This is a glyph; use `set-glyph-image' to change it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 If unspecified in a particular domain, the window-system-provided
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 default pointer is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 Fprovide (intern ("scrollbar"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 specifier_vars_of_scrollbar (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 DEFVAR_SPECIFIER ("scrollbar-width", &Vscrollbar_width /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 *Width of vertical scrollbars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 This is a specifier; use `set-specifier' to change it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 */ );
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
935 Vscrollbar_width = make_magic_specifier (Qnatnum);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 set_specifier_fallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (Vscrollbar_width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 list1 (Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_WIDTH))));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 set_specifier_caching (Vscrollbar_width,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
940 slot_offset (struct window,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
941 scrollbar_width),
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
942 vertical_scrollbar_changed_in_window,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
943 slot_offset (struct frame,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
944 scrollbar_width),
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
945 frame_size_slipped);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 DEFVAR_SPECIFIER ("scrollbar-height", &Vscrollbar_height /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 *Height of horizontal scrollbars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 This is a specifier; use `set-specifier' to change it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 */ );
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
951 Vscrollbar_height = make_magic_specifier (Qnatnum);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 set_specifier_fallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (Vscrollbar_height,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 list1 (Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_HEIGHT))));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 set_specifier_caching (Vscrollbar_height,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
956 slot_offset (struct window,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
957 scrollbar_height),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 some_window_value_changed,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
959 slot_offset (struct frame,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
960 scrollbar_height),
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
961 frame_size_slipped);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
962
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
963 DEFVAR_SPECIFIER ("horizontal-scrollbar-visible-p", &Vhorizontal_scrollbar_visible_p /*
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
964 *Whether the horizontal scrollbar is visible.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
965 This is a specifier; use `set-specifier' to change it.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
966 */ );
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
967 Vhorizontal_scrollbar_visible_p = Fmake_specifier (Qboolean);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
968 set_specifier_fallback (Vhorizontal_scrollbar_visible_p,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
969 list1 (Fcons (Qnil, Qt)));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
970 set_specifier_caching (Vhorizontal_scrollbar_visible_p,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
971 slot_offset (struct window,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
972 horizontal_scrollbar_visible_p),
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
973 some_window_value_changed,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
974 slot_offset (struct frame,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
975 horizontal_scrollbar_visible_p),
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
976 frame_size_slipped);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
977
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
978 DEFVAR_SPECIFIER ("vertical-scrollbar-visible-p", &Vvertical_scrollbar_visible_p /*
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
979 *Whether the vertical scrollbar is visible.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
980 This is a specifier; use `set-specifier' to change it.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
981 */ );
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
982 Vvertical_scrollbar_visible_p = Fmake_specifier (Qboolean);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
983 set_specifier_fallback (Vvertical_scrollbar_visible_p,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
984 list1 (Fcons (Qnil, Qt)));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
985 set_specifier_caching (Vvertical_scrollbar_visible_p,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
986 slot_offset (struct window,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
987 vertical_scrollbar_visible_p),
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
988 vertical_scrollbar_changed_in_window,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
989 slot_offset (struct frame,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
990 vertical_scrollbar_visible_p),
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
991 frame_size_slipped);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
992
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
993 DEFVAR_SPECIFIER ("scrollbar-on-left-p", &Vscrollbar_on_left_p /*
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
994 *Whether the vertical scrollbar is on the left side of window or frame.
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
995 This is a specifier; use `set-specifier' to change it.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
996 */ );
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
997 Vscrollbar_on_left_p = Fmake_specifier (Qboolean);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
998
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
999 {
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
1000 /* Kludge. Under X, we want athena scrollbars on the left,
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1001 while all other scrollbars go on the right by default. */
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1002 Lisp_Object fallback = list1 (Fcons (Qnil, Qnil));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1003 #if defined (HAVE_X_WINDOWS) \
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1004 && !defined (LWLIB_SCROLLBARS_MOTIF) \
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1005 && !defined (LWLIB_SCROLLBARS_LUCID) \
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1006 && !defined (LWLIB_SCROLLBARS_ATHENA3D)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1007
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1008 fallback = Fcons (Fcons (list1 (Qx), Qt), fallback);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1009 #endif
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1010 set_specifier_fallback (Vscrollbar_on_left_p, fallback);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1011 }
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1012
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1013 set_specifier_caching (Vscrollbar_on_left_p,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1014 slot_offset (struct window,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1015 scrollbar_on_left_p),
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1016 vertical_scrollbar_changed_in_window,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1017 slot_offset (struct frame,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1018 scrollbar_on_left_p),
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1019 frame_size_slipped);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1020
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1021 DEFVAR_SPECIFIER ("scrollbar-on-top-p", &Vscrollbar_on_top_p /*
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
1022 *Whether the horizontal scrollbar is on the top side of window or frame.
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1023 This is a specifier; use `set-specifier' to change it.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1024 */ );
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1025 Vscrollbar_on_top_p = Fmake_specifier (Qboolean);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1026 set_specifier_fallback (Vscrollbar_on_top_p,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1027 list1 (Fcons (Qnil, Qnil)));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1028 set_specifier_caching (Vscrollbar_on_top_p,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1029 slot_offset (struct window,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1030 scrollbar_on_top_p),
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1031 some_window_value_changed,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1032 slot_offset (struct frame,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1033 scrollbar_on_top_p),
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
1034 frame_size_slipped);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 complex_vars_of_scrollbar (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 Vscrollbar_pointer_glyph = Fmake_glyph_internal (Qpointer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 set_specifier_caching (XGLYPH (Vscrollbar_pointer_glyph)->image,
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1043 slot_offset (struct window,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
1044 scrollbar_pointer),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 scrollbar_pointer_changed_in_window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 }