Mercurial > hg > xemacs-beta
comparison src/scrollbar-msw.c @ 771:943eaba38521
[xemacs-hg @ 2002-03-13 08:51:24 by ben]
The big ben-mule-21-5 check-in!
Various files were added and deleted. See CHANGES-ben-mule.
There are still some test suite failures. No crashes, though.
Many of the failures have to do with problems in the test suite itself
rather than in the actual code. I'll be addressing these in the next
day or so -- none of the test suite failures are at all critical.
Meanwhile I'll be trying to address the biggest issues -- i.e. build
or run failures, which will almost certainly happen on various platforms.
All comments should be sent to ben@xemacs.org -- use a Cc: if necessary
when sending to mailing lists. There will be pre- and post- tags,
something like
pre-ben-mule-21-5-merge-in, and
post-ben-mule-21-5-merge-in.
author | ben |
---|---|
date | Wed, 13 Mar 2002 08:54:06 +0000 |
parents | a307f9a2021d |
children | e38acbeb1cae |
comparison
equal
deleted
inserted
replaced
770:336a418893b5 | 771:943eaba38521 |
---|---|
1 /* scrollbar implementation -- mswindows interface. | 1 /* scrollbar implementation -- mswindows interface. |
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. | 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. |
3 Copyright (C) 1994 Amdahl Corporation. | 3 Copyright (C) 1994 Amdahl Corporation. |
4 Copyright (C) 1995 Sun Microsystems, Inc. | 4 Copyright (C) 1995 Sun Microsystems, Inc. |
5 Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>. | 5 Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>. |
6 Copyright (C) 2001 Ben Wing. | 6 Copyright (C) 2001, 2002 Ben Wing. |
7 | 7 |
8 This file is part of XEmacs. | 8 This file is part of XEmacs. |
9 | 9 |
10 XEmacs is free software; you can redistribute it and/or modify it | 10 XEmacs is free software; you can redistribute it and/or modify it |
11 under the terms of the GNU General Public License as published by the | 11 under the terms of the GNU General Public License as published by the |
21 along with XEmacs; see the file COPYING. If not, write to | 21 along with XEmacs; see the file COPYING. If not, write to |
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
23 Boston, MA 02111-1307, USA. */ | 23 Boston, MA 02111-1307, USA. */ |
24 | 24 |
25 /* Synched up with: Not in FSF. */ | 25 /* Synched up with: Not in FSF. */ |
26 | |
27 /* This file essentially Mule-ized (except perhaps some Unicode splitting). | |
28 5-2000. */ | |
26 | 29 |
27 #include <config.h> | 30 #include <config.h> |
28 #include "lisp.h" | 31 #include "lisp.h" |
29 | 32 |
30 #include "console-msw.h" | 33 #include "console-msw.h" |
64 orientation = SBS_VERT; | 67 orientation = SBS_VERT; |
65 else | 68 else |
66 orientation = SBS_HORZ; | 69 orientation = SBS_HORZ; |
67 | 70 |
68 SCROLLBAR_MSW_HANDLE (sb) = | 71 SCROLLBAR_MSW_HANDLE (sb) = |
69 CreateWindowEx (0, "SCROLLBAR", 0, orientation|WS_CHILD, | 72 qxeCreateWindowEx (0, XETEXT ("SCROLLBAR"), 0, orientation|WS_CHILD, |
70 CW_USEDEFAULT, CW_USEDEFAULT, | 73 CW_USEDEFAULT, CW_USEDEFAULT, |
71 CW_USEDEFAULT, CW_USEDEFAULT, | 74 CW_USEDEFAULT, CW_USEDEFAULT, |
72 FRAME_MSWINDOWS_HANDLE (f), | 75 FRAME_MSWINDOWS_HANDLE (f), |
73 NULL, NULL, NULL); | 76 NULL, NULL, NULL); |
74 SCROLLBAR_MSW_INFO (sb).cbSize = sizeof (SCROLLINFO); | 77 SCROLLBAR_MSW_INFO (sb).cbSize = sizeof (SCROLLINFO); |
75 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL; | 78 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL; |
76 GetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, | 79 GetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, |
77 &SCROLLBAR_MSW_INFO (sb)); | 80 &SCROLLBAR_MSW_INFO (sb)); |
78 ptr = make_opaque_ptr (SCROLLBAR_MSW_HANDLE (sb)); | 81 ptr = make_opaque_ptr (SCROLLBAR_MSW_HANDLE (sb)); |
79 Fputhash (ptr, wrap_scrollbar_instance (sb), | 82 Fputhash (ptr, wrap_scrollbar_instance (sb), |
80 Vmswindows_scrollbar_instance_table); | 83 Vmswindows_scrollbar_instance_table); |
81 SetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA, | 84 qxeSetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA, |
82 (LONG) LISP_TO_VOID (ptr)); | 85 (LONG) LISP_TO_VOID (ptr)); |
83 } | 86 } |
84 | 87 |
85 static void | 88 static void |
86 mswindows_free_scrollbar_instance (struct scrollbar_instance *sb) | 89 mswindows_free_scrollbar_instance (struct scrollbar_instance *sb) |
87 { | 90 { |
88 void *opaque = | 91 void *opaque = |
89 (void *) GetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA); | 92 (void *) qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA); |
90 Lisp_Object ptr; | 93 Lisp_Object ptr; |
91 | 94 |
92 VOID_TO_LISP (ptr, opaque); | 95 VOID_TO_LISP (ptr, opaque); |
93 assert (OPAQUE_PTRP (ptr)); | 96 assert (OPAQUE_PTRP (ptr)); |
94 ptr = Fremhash (ptr, Vmswindows_scrollbar_instance_table); | 97 ptr = Fremhash (ptr, Vmswindows_scrollbar_instance_table); |
135 int new_scrollbar_height, | 138 int new_scrollbar_height, |
136 int new_scrollbar_x, | 139 int new_scrollbar_x, |
137 int new_scrollbar_y) | 140 int new_scrollbar_y) |
138 { | 141 { |
139 int pos_changed = 0; | 142 int pos_changed = 0; |
140 int vert = GetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_STYLE) & SBS_VERT; | 143 int vert = qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_STYLE) & SBS_VERT; |
141 | 144 |
142 #if 0 | 145 #if 0 |
143 stderr_out ("[%d, %d], page = %d, pos = %d, inhibit = %d\n", new_minimum, new_maximum, | 146 stderr_out ("[%d, %d], page = %d, pos = %d, inhibit = %d\n", new_minimum, new_maximum, |
144 new_slider_size, new_slider_position,inhibit_slider_size_change); | 147 new_slider_size, new_slider_position,inhibit_slider_size_change); |
145 #endif | 148 #endif |
199 struct frame *f; | 202 struct frame *f; |
200 Lisp_Object win, frame; | 203 Lisp_Object win, frame; |
201 struct scrollbar_instance *sb = 0; | 204 struct scrollbar_instance *sb = 0; |
202 void *v; | 205 void *v; |
203 SCROLLINFO scrollinfo; | 206 SCROLLINFO scrollinfo; |
204 int vert = GetWindowLong (hwnd, GWL_STYLE) & SBS_VERT; | 207 int vert = qxeGetWindowLong (hwnd, GWL_STYLE) & SBS_VERT; |
205 int value; | 208 int value; |
206 | 209 |
207 v = (void *) GetWindowLong (hwnd, GWL_USERDATA); | 210 v = (void *) qxeGetWindowLong (hwnd, GWL_USERDATA); |
208 if (!v) | 211 if (!v) |
209 { | 212 { |
210 /* apparently this can happen, as it was definitely necessary | 213 /* apparently this can happen, as it was definitely necessary |
211 to put the check in for sb below (VERTICAL_SCROLLBAR_DRAG_HACK) */ | 214 to put the check in for sb below (VERTICAL_SCROLLBAR_DRAG_HACK) */ |
212 frame = mswindows_find_frame (hwnd); | 215 frame = mswindows_find_frame (hwnd); |
315 break; | 318 break; |
316 } | 319 } |
317 } | 320 } |
318 | 321 |
319 static int | 322 static int |
320 can_scroll (struct scrollbar_instance* scrollbar) | 323 can_scroll (struct scrollbar_instance *scrollbar) |
321 { | 324 { |
322 return scrollbar != NULL | 325 return scrollbar != NULL |
323 && IsWindowVisible (SCROLLBAR_MSW_HANDLE (scrollbar)) | 326 && IsWindowVisible (SCROLLBAR_MSW_HANDLE (scrollbar)) |
324 && IsWindowEnabled (SCROLLBAR_MSW_HANDLE (scrollbar)); | 327 && IsWindowEnabled (SCROLLBAR_MSW_HANDLE (scrollbar)); |
325 } | 328 } |
345 | 348 |
346 /* The mouse event could actually occur outside of the emacs | 349 /* The mouse event could actually occur outside of the emacs |
347 frame. */ | 350 frame. */ |
348 if (ScreenToClient (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), | 351 if (ScreenToClient (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), |
349 &donde_esta) != 0) | 352 &donde_esta) != 0) |
350 { | 353 /* stderr_out ("donde_esta: %d %d\n", donde_esta.x, donde_esta.y); */ |
351 /* stderr_out ("donde_esta: %d %d\n", donde_esta.x, donde_esta.y); */ | 354 pixel_to_glyph_translation (XFRAME (frame), donde_esta.x, donde_esta.y, |
352 pixel_to_glyph_translation (XFRAME (frame), donde_esta.x, donde_esta.y, | 355 &mene, &_mene, &tekel, &upharsin, |
353 &mene, &_mene, &tekel, &upharsin, | 356 &needle_in_haystack, |
354 &needle_in_haystack, | 357 &mens, &sana, &in, &corpore, &sano); |
355 &mens, &sana, &in, &corpore, &sano); | 358 |
356 | 359 if (needle_in_haystack) |
357 if (needle_in_haystack) | 360 { |
358 { | 361 XSETWINDOW (win, needle_in_haystack); |
359 XSETWINDOW (win, needle_in_haystack); | 362 /* stderr_out ("found needle\n"); |
360 /* stderr_out ("found needle\n"); | 363 debug_print (win); */ |
361 debug_print (win); */ | 364 } |
362 } | 365 else |
363 } | |
364 | |
365 if (!needle_in_haystack) | |
366 { | 366 { |
367 win = FRAME_SELECTED_WINDOW (XFRAME (frame)); | 367 win = FRAME_SELECTED_WINDOW (XFRAME (frame)); |
368 needle_in_haystack = XWINDOW (win); | 368 needle_in_haystack = XWINDOW (win); |
369 } | 369 } |
370 | 370 |
379 /* No support for panning and zooming, so ignore */ | 379 /* No support for panning and zooming, so ignore */ |
380 if (keys & (MK_SHIFT | MK_CONTROL)) | 380 if (keys & (MK_SHIFT | MK_CONTROL)) |
381 return FALSE; | 381 return FALSE; |
382 | 382 |
383 /* Get the number of lines per wheel delta */ | 383 /* Get the number of lines per wheel delta */ |
384 SystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &wheelScrollLines, 0); | 384 qxeSystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &wheelScrollLines, 0); |
385 | 385 |
386 /* Calculate the amount to scroll */ | 386 /* Calculate the amount to scroll */ |
387 if (wheelScrollLines == WHEEL_PAGESCROLL) | 387 if (wheelScrollLines == WHEEL_PAGESCROLL) |
388 { | 388 { |
389 /* Scroll by a page */ | 389 /* Scroll by a page */ |