source: trunk/src/user32/new/oslibwin.cpp@ 2290

Last change on this file since 2290 was 2290, checked in by cbratschi, 26 years ago

* empty log message *

File size: 40.4 KB
Line 
1/* $Id: oslibwin.cpp,v 1.29 2000-01-01 14:57:20 cbratschi Exp $ */
2/*
3 * Window API wrappers for OS/2
4 *
5 *
6 * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
7 * Copyright 1999 Daniela Engert (dani@ngrt.de)
8 *
9 *
10 * Project Odin Software License can be found in LICENSE.TXT
11 *
12 */
13#define INCL_WIN
14#define INCL_PM
15#include <os2.h>
16#include <os2wrap.h>
17#include <stdlib.h>
18#include <string.h>
19
20#include <misc.h>
21#include "win32type.h"
22#include <winconst.h>
23#include "oslibwin.h"
24#include "oslibutil.h"
25#include "oslibmsg.h"
26#include "oslibgdi.h"
27#include "pmwindow.h"
28
29#define HAS_3DFRAME(exStyle) \
30 ((exStyle & WS_EX_CLIENTEDGE_W) || (exStyle & WS_EX_STATICEDGE_W) || (exStyle & WS_EX_WINDOWEDGE_W))
31
32//******************************************************************************
33//******************************************************************************
34BOOL OSLibWinSetParent(HWND hwnd, HWND hwndParent, ULONG fRedraw)
35{
36 if(hwndParent == OSLIB_HWND_DESKTOP)
37 {
38 hwndParent = HWND_DESKTOP;
39 }
40 else
41 if(hwndParent == OSLIB_HWND_OBJECT) {
42 hwndParent = HWND_OBJECT;
43 }
44 return (WinSetParent(hwnd, hwndParent, fRedraw) == 0);
45}
46//******************************************************************************
47//******************************************************************************
48BOOL OSLibWinSetOwner(HWND hwnd, HWND hwndOwner)
49{
50 return WinSetOwner(hwnd, hwndOwner);
51}
52//******************************************************************************
53//******************************************************************************
54HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
55 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame,
56 ULONG id, BOOL fTaskList)
57{
58 HWND hwndClient;
59
60 dprintf(("WinCreateWindow %x %x %x %s", hwndParent, dwWinStyle, dwFrameStyle, pszName));
61
62 if(pszName && *pszName == 0) {
63 pszName = NULL;
64 }
65 if(hwndParent == OSLIB_HWND_DESKTOP) {
66 hwndParent = HWND_DESKTOP;
67 }
68 if(Owner == OSLIB_HWND_DESKTOP) {
69 Owner = HWND_DESKTOP;
70 }
71 ULONG dwClientStyle;
72#if 1
73
74 BOOL TopLevel = hwndParent == HWND_DESKTOP;
75// if(dwFrameStyle & FCF_TITLEBAR)
76// TopLevel = TRUE;
77
78 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0};
79
80 dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPSIBLINGS);
81
82 dwFrameStyle |= FCF_NOBYTEALIGN;
83 if(fTaskList)
84 {
85 dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
86 }
87
88 dwWinStyle &= ~WS_CLIPCHILDREN;
89 FCData.flCreateFlags = dwFrameStyle;
90
91 *hwndFrame = WinCreateWindow (hwndParent,
92 TopLevel ? WC_FRAME : WIN32_INNERFRAME,
93 pszName, dwWinStyle, 0, 0, 50, 30,
94 hwndParent, HWND_TOP,
95 id, &FCData, NULL);
96 if (*hwndFrame) {
97 hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS,
98 NULL, dwClientStyle, 0, 0, 0, 0,
99 *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL);
100 if (hwndClient != NULLHANDLE)
101 WinSendMsg (*hwndFrame, WM_UPDATEFRAME, 0, 0);
102
103 return hwndClient;
104 }
105 dprintf(("OSLibWinCreateWindow: (FRAME) WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
106 return 0;
107#else
108 dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP);
109
110 dwFrameStyle |= FCF_NOBYTEALIGN;
111 if ((hwndParent == HWND_DESKTOP) && (dwFrameStyle & FCF_TITLEBAR))
112 dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
113
114 dwWinStyle &= ~WS_CLIPCHILDREN;
115
116 *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
117 &dwFrameStyle, WIN32_STDCLASS,
118 "", dwClientStyle, 0, id, &hwndClient);
119 if(*hwndFrame) {
120 if(pszName) {
121 WinSetWindowText(*hwndFrame, pszName);
122 }
123 return hwndClient;
124 }
125 dprintf(("OSLibWinCreateWindow: (FRAME) WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
126 return 0;
127#endif
128}
129//******************************************************************************
130//******************************************************************************
131BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG *dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight)
132{
133 *OSWinStyle = 0;
134 *OSFrameStyle = 0;
135 *borderWidth = 0;
136 *borderHeight = 0;
137
138 /* Window styles */
139 if(dwStyle & WS_MINIMIZE_W)
140 *OSWinStyle |= WS_MINIMIZED;
141//Done explicitely in CreateWindowExA
142#if 1
143 if(dwStyle & WS_VISIBLE_W)
144 *OSWinStyle |= WS_VISIBLE;
145#endif
146 if(dwStyle & WS_DISABLED_W)
147 *OSWinStyle |= WS_DISABLED;
148 if(dwStyle & WS_CLIPSIBLINGS_W)
149 *OSWinStyle |= WS_CLIPSIBLINGS;
150 if(dwStyle & WS_CLIPCHILDREN_W)
151 *OSWinStyle |= WS_CLIPCHILDREN;
152 if(dwStyle & WS_MAXIMIZE_W)
153 *OSWinStyle |= WS_MAXIMIZED;
154 if(dwStyle & WS_GROUP_W)
155 *OSWinStyle |= WS_GROUP;
156 if(dwStyle & WS_TABSTOP_W)
157 *OSWinStyle |= WS_TABSTOP;
158
159 if(dwStyle & WS_CHILD_W && !((dwStyle & WS_CAPTION_W) == WS_CAPTION_W))
160 {
161//SvL: Causes crash in VPBuddy if enabled -> find bug
162#if 0
163 if (!HAS_3DFRAME(*dwExStyle) && (dwStyle & (WS_DLGFRAME_W | WS_THICKFRAME_W))) *dwExStyle |= WS_EX_DLGMODALFRAME_W;
164#endif
165
166 if (*dwExStyle & WS_EX_CLIENTEDGE_W)
167 {
168 *OSFrameStyle |= FCF_SIZEBORDER;
169 *borderHeight = *borderWidth = 2;
170 }
171 else
172 if (*dwExStyle & WS_EX_DLGMODALFRAME_W)
173 {
174 *OSFrameStyle |= FCF_SIZEBORDER;
175 *borderHeight = *borderWidth = 3;
176 }
177 else
178 if (*dwExStyle & WS_EX_STATICEDGE_W)
179 {
180 *OSFrameStyle |= FCF_SIZEBORDER;
181 *borderHeight = *borderWidth = 2;
182 }
183 else
184 if(dwStyle & WS_BORDER_W)
185 {
186 *OSFrameStyle |= FCF_BORDER;
187 *borderHeight = *borderWidth = 1;
188 }
189 else if (*dwExStyle & WS_EX_WINDOWEDGE_W); //no border
190
191 if(dwStyle & WS_VSCROLL_W)
192 *OSFrameStyle |= FCF_VERTSCROLL;
193 if(dwStyle & WS_HSCROLL_W)
194 *OSFrameStyle |= FCF_HORZSCROLL;
195 }
196 else
197 {
198 if((dwStyle & WS_CAPTION_W) == WS_DLGFRAME_W)
199 *OSFrameStyle |= FCF_DLGBORDER;
200 else
201 {
202 if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W)
203 *OSFrameStyle |= (FCF_TITLEBAR | FCF_BORDER);
204 else
205 if(dwStyle & WS_BORDER_W)
206 *OSFrameStyle |= FCF_BORDER;
207 }
208
209 if(dwStyle & WS_VSCROLL_W)
210 *OSFrameStyle |= FCF_VERTSCROLL;
211 if(dwStyle & WS_HSCROLL_W)
212 *OSFrameStyle |= FCF_HORZSCROLL;
213
214 if(dwStyle & WS_SYSMENU_W)
215 *OSFrameStyle |= FCF_SYSMENU;
216 if(dwStyle & WS_THICKFRAME_W)
217 *OSFrameStyle |= FCF_SIZEBORDER; //??
218 if(dwStyle & WS_MINIMIZEBOX_W)
219 *OSFrameStyle |= FCF_MINBUTTON;
220 if(dwStyle & WS_MAXIMIZEBOX_W)
221 *OSFrameStyle |= FCF_MAXBUTTON;
222
223 if(*dwExStyle & WS_EX_DLGMODALFRAME_W)
224 *OSFrameStyle |= FCF_DLGBORDER;
225 }
226
227 //Clear certain frame bits when the window doesn't have a titlebar
228 if(!(*OSFrameStyle & FCF_TITLEBAR)) {
229 *OSFrameStyle &= ~(FCF_MINBUTTON|FCF_MAXBUTTON|FCF_SYSMENU);
230 }
231 return TRUE;
232}
233//******************************************************************************
234//******************************************************************************
235BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value)
236{
237 if(offset == OSLIB_QWL_USER)
238 offset = QWL_USER;
239
240 return WinSetWindowULong(hwnd, offset, value);
241}
242//******************************************************************************
243//******************************************************************************
244ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset)
245{
246 if(offset == OSLIB_QWL_USER)
247 offset = QWL_USER;
248
249 return WinQueryWindowULong(hwnd, offset);
250}
251//******************************************************************************
252//******************************************************************************
253BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle)
254{
255 return WinAlarm(hwndDeskTop,flStyle);
256}
257//******************************************************************************
258//******************************************************************************
259APIRET OSLibDosBeep(ULONG freg,ULONG dur)
260{
261 return DosBeep(freg,dur);
262}
263//******************************************************************************
264//******************************************************************************
265HWND OSLibWinQueryFocus(HWND hwndDeskTop)
266{
267 return WinQueryFocus(hwndDeskTop);
268}
269//******************************************************************************
270//******************************************************************************
271HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id)
272{
273 return WinWindowFromID(hwndParent,id);
274}
275//******************************************************************************
276//******************************************************************************
277BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus, BOOL activate)
278{
279 return WinFocusChange (hwndDeskTop, hwndNewFocus, activate ? FC_NOLOSEACTIVE : 0);
280}
281//******************************************************************************
282//******************************************************************************
283BOOL OSLibWinIsChild (HWND hwnd, HWND hwndOf)
284{
285 return WinIsChild (hwnd, hwndOf);
286}
287//******************************************************************************
288//******************************************************************************
289ULONG OSLibGetWindowHeight(HWND hwnd)
290{
291 RECTL rect;
292
293 return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0;
294}
295//******************************************************************************
296//******************************************************************************
297LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue)
298{
299 return WinQuerySysValue(hwndDeskTop,iSysValue);
300}
301//******************************************************************************
302//******************************************************************************
303ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer)
304{
305 return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer);
306}
307//******************************************************************************
308//******************************************************************************
309BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText)
310{
311 return WinSetDlgItemText(hwndDlg,idItem,pszText);
312}
313//******************************************************************************
314//******************************************************************************
315BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint)
316{
317 return WinQueryPointerPos(hwndDeskTop,(PPOINTL)pptlPoint);
318}
319//******************************************************************************
320//******************************************************************************
321HWND OSLibWinQueryWindow(HWND hwnd, ULONG lCode)
322{
323 return WinQueryWindow(hwnd, lCode);
324}
325//******************************************************************************
326//******************************************************************************
327BOOL OSLibWinSetMultWindowPos(PSWP pswp, ULONG num)
328{
329 return WinSetMultWindowPos(GetThreadHAB(), pswp, num);
330}
331//******************************************************************************
332//******************************************************************************
333BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
334{
335 BOOL rc = 1;
336
337 if(fl & SWP_SHOW) {
338 rc = WinShowWindow(hwnd, TRUE);
339 }
340 if(rc == 0)
341 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
342 rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
343 if(rc == 0)
344 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
345 return rc;
346}
347//******************************************************************************
348//******************************************************************************
349BOOL OSLibWinDestroyWindow(HWND hwnd)
350{
351 return WinDestroyWindow(hwnd);
352}
353//******************************************************************************
354//******************************************************************************
355BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo)
356{
357 BOOL rc;
358 RECTLOS2 rectl;
359
360 rc = WinQueryWindowRect(hwnd, (PRECTL)&rectl);
361 if(rc) {
362 if(RelativeTo == RELATIVE_TO_SCREEN) {
363 mapOS2ToWin32Rect(hwnd,OSLIB_HWND_DESKTOP,&rectl,pRect);
364 }
365 else mapOS2ToWin32Rect(hwnd,&rectl,pRect);
366 }
367 else memset(pRect, 0, sizeof(RECT));
368 return rc;
369}
370//******************************************************************************
371//******************************************************************************
372BOOL OSLibWinIsIconic(HWND hwnd)
373{
374 SWP swp;
375 BOOL rc;
376
377 rc = WinQueryWindowPos(hwnd, &swp);
378 if(rc == FALSE) {
379 dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
380 return FALSE;
381 }
382
383 if(swp.fl & SWP_MINIMIZE)
384 return TRUE;
385 else return FALSE;
386}
387//******************************************************************************
388//******************************************************************************
389BOOL OSLibWinSetActiveWindow(HWND hwnd)
390{
391 return WinSetActiveWindow(HWND_DESKTOP, hwnd);
392}
393//******************************************************************************
394//******************************************************************************
395BOOL OSLibWinSetFocus(HWND hwnd)
396{
397 return WinSetFocus(HWND_DESKTOP, hwnd);
398}
399//******************************************************************************
400//******************************************************************************
401BOOL OSLibWinEnableWindow(HWND hwnd, BOOL fEnable)
402{
403 BOOL rc;
404 HWND hwndClient;
405
406 rc = WinEnableWindow(hwnd, fEnable);
407 hwndClient = WinWindowFromID(hwnd, FID_CLIENT);
408 if(hwndClient) {
409 WinEnableWindow(hwndClient, fEnable);
410 }
411 return rc;
412}
413//******************************************************************************
414//******************************************************************************
415BOOL OSLibWinIsWindowEnabled(HWND hwnd)
416{
417 return WinIsWindowEnabled(hwnd);
418}
419//******************************************************************************
420//******************************************************************************
421BOOL OSLibWinIsWindowVisible(HWND hwnd)
422{
423 return WinIsWindowVisible(hwnd);
424}
425//******************************************************************************
426//******************************************************************************
427BOOL OSLibWinQueryActiveWindow()
428{
429 return WinQueryActiveWindow(HWND_DESKTOP);
430}
431//******************************************************************************
432//******************************************************************************
433LONG OSLibWinQueryWindowTextLength(HWND hwnd)
434{
435 return WinQueryWindowTextLength(hwnd);
436}
437//******************************************************************************
438//******************************************************************************
439LONG OSLibWinQueryWindowText(HWND hwnd, LONG length, LPSTR lpsz)
440{
441 return WinQueryWindowText(hwnd, length, lpsz);
442}
443//******************************************************************************
444//******************************************************************************
445BOOL OSLibWinSetWindowText(HWND hwnd, LPSTR lpsz)
446{
447 return WinSetWindowText(hwnd, lpsz);
448}
449//******************************************************************************
450//******************************************************************************
451BOOL OSLibWinFlashWindow(HWND hwnd, BOOL fFlash)
452{
453 return WinFlashWindow(hwnd, fFlash);
454}
455//******************************************************************************
456//******************************************************************************
457HWND OSLibWinWindowFromPoint(HWND hwnd, PVOID ppoint)
458{
459 return WinWindowFromPoint((hwnd == OSLIB_HWND_DESKTOP) ? HWND_DESKTOP : hwnd, (PPOINTL)ppoint, TRUE);
460}
461//******************************************************************************
462//******************************************************************************
463BOOL OSLibWinMinimizeWindow(HWND hwnd)
464{
465 return WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_MINIMIZE);
466}
467//******************************************************************************
468//******************************************************************************
469BOOL OSLibWinGetBorderSize(HWND hwnd, OSLIBPOINT *pointl)
470{
471 pointl->x = 0;
472 pointl->y = 0;
473 return (BOOL) WinSendMsg(hwnd, WM_QUERYBORDERSIZE, MPFROMP( &pointl), 0);
474}
475//******************************************************************************
476//******************************************************************************
477BOOL OSLibWinSetIcon(HWND hwnd, HANDLE hIcon)
478{
479 return (BOOL) WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0);
480}
481//******************************************************************************
482//******************************************************************************
483BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp)
484{
485 return WinQueryWindowPos(hwnd, pswp);
486}
487//******************************************************************************
488//******************************************************************************
489void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
490{
491 HWND hWindow = pswp->hwnd;
492 HWND hWndInsertAfter = pswp->hwndInsertBehind;
493 long x = pswp->x;
494 long y = pswp->y;
495 long cx = pswp->cx;
496 long cy = pswp->cy;
497 UINT fuFlags = (UINT)pswp->fl;
498 ULONG parentHeight;
499
500 HWND hWinAfter;
501 ULONG flags = 0;
502 SWP swpFrame, swpClient;
503 POINTL point;
504
505 HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
506
507 if (hWndInsertAfter == HWND_TOP)
508 hWinAfter = HWND_TOP_W;
509 else if (hWndInsertAfter == HWND_BOTTOM)
510 hWinAfter = HWND_BOTTOM_W;
511 else
512 hWinAfter = (HWND) hWndInsertAfter;
513
514 //***********************************
515 // convert PM flags to Windows flags
516 //***********************************
517 if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
518 if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
519 if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
520 if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
521 if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
522 if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
523 if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
524 if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
525
526 WinQueryWindowPos(hFrame, &swpFrame);
527
528 if(fuFlags & (SWP_MOVE | SWP_SIZE))
529 {
530 point.x = swpFrame.x;
531 point.y = swpFrame.y;
532 if(hParent)
533 {
534 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
535 }
536 point.y = ScreenHeight-point.y-swpFrame.cy;
537
538 cy = swpFrame.cy;
539 cx = swpFrame.cx;
540 x = point.x;
541 y = point.y;
542
543 if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
544 flags |= SWP_NOMOVE_W;
545
546 if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
547 flags |= SWP_NOSIZE_W;
548
549 if (fuFlags & SWP_SIZE)
550 {
551 if (pswp->cy != pswpOld->cy)
552 {
553 flags &= ~SWP_NOMOVE_W;
554 }
555 }
556 }
557
558 pswpOld->x = pswp->x;
559 pswpOld->y = swpFrame.cy-pswp->y-pswp->cy;
560 pswpOld->cx = pswp->cx;
561 pswpOld->cy = pswp->cy;
562
563 dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
564 x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
565
566 pwpos->flags = (UINT)flags;
567 pwpos->cy = cy;
568 pwpos->cx = cx;
569 pwpos->x = x;
570 pwpos->y = y;
571 pwpos->hwndInsertAfter = hWinAfter;
572 pwpos->hwnd = hWindow;
573}
574//******************************************************************************
575//******************************************************************************
576void OSLibMapSWPtoWINDOWPOSFrame(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
577{
578 HWND hWindow = pswp->hwnd;
579 HWND hWndInsertAfter = pswp->hwndInsertBehind;
580 long x = pswp->x;
581 long y = pswp->y;
582 long cx = pswp->cx;
583 long cy = pswp->cy;
584 UINT fuFlags = (UINT)pswp->fl;
585 ULONG parentHeight;
586
587 HWND hWinAfter;
588 ULONG flags = 0;
589 SWP swpClient;
590 POINTL point;
591
592 HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
593
594 if (hWndInsertAfter == HWND_TOP)
595 hWinAfter = HWND_TOP_W;
596 else if (hWndInsertAfter == HWND_BOTTOM)
597 hWinAfter = HWND_BOTTOM_W;
598 else
599 hWinAfter = (HWND) hWndInsertAfter;
600
601 //***********************************
602 // convert PM flags to Windows flags
603 //***********************************
604 if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
605 if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
606 if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
607 if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
608 if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
609 if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
610 if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
611 if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
612
613 WinQueryWindowPos(WinWindowFromID(hFrame, FID_CLIENT), &swpClient);
614
615 if(fuFlags & (SWP_MOVE | SWP_SIZE))
616 {
617 point.x = x;
618 point.y = y;
619 if(hParent)
620 {
621 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
622 }
623 point.y = ScreenHeight-point.y-cy;
624
625 x = point.x;
626 y = point.y;
627
628 if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
629 flags |= SWP_NOMOVE_W;
630
631 if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
632 flags |= SWP_NOSIZE_W;
633
634 if (fuFlags & SWP_SIZE)
635 {
636 if (pswp->cy != pswpOld->cy)
637 {
638 flags &= ~SWP_NOMOVE_W;
639 }
640 }
641 }
642
643 pswpOld->x = swpClient.x;
644 pswpOld->y = pswp->cy-swpClient.y-swpClient.cy;
645 pswpOld->cx = swpClient.cx;
646 pswpOld->cy = swpClient.cy;
647
648 dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
649 x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
650
651 pwpos->flags = (UINT)flags;
652 pwpos->cy = cy;
653 pwpos->cx = cx;
654 pwpos->x = x;
655 pwpos->y = y;
656 pwpos->hwndInsertAfter = hWinAfter;
657 pwpos->hwnd = hWindow;
658}
659//******************************************************************************
660//******************************************************************************
661void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
662{
663 BOOL fCvt = FALSE;
664
665 HWND hWnd = pwpos->hwnd;
666 HWND hWndInsertAfter = pwpos->hwndInsertAfter;
667 long x = pwpos->x;
668 long y = pwpos->y;
669 long cx = pwpos->cx;
670 long cy = pwpos->cy;
671 UINT fuFlags = pwpos->flags;
672 ULONG parentHeight;
673
674 HWND hWinAfter;
675 ULONG flags = 0;
676 HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
677
678 if (hWndInsertAfter == HWND_TOPMOST_W)
679// hWinAfter = HWND_TOPMOST;
680 hWinAfter = HWND_TOP;
681 else if (hWndInsertAfter == HWND_NOTOPMOST_W)
682// hWinAfter = HWND_NOTOPMOST;
683 hWinAfter = HWND_TOP;
684 else if (hWndInsertAfter == HWND_TOP_W)
685 hWinAfter = HWND_TOP;
686 else if (hWndInsertAfter == HWND_BOTTOM_W)
687 hWinAfter = HWND_BOTTOM;
688 else
689 hWinAfter = (HWND) hWndInsertAfter;
690
691 if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
692 if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
693 if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
694 if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
695 if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
696 if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
697 if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
698 if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
699
700 if (flags & (SWP_MOVE | SWP_SIZE))
701 {
702 if (hParent == NULLHANDLE)
703 parentHeight = ScreenHeight;
704 else
705 parentHeight = OSLibGetWindowHeight(hParent);
706
707 if ((flags & SWP_MOVE) == 0)
708 {
709 x = pswpOld->x;
710 y = pswpOld->y;
711
712 if (!((y == 0) && (pswpOld->cy == 0)))
713 {
714 y = parentHeight-y-pswpOld->cy;
715 }
716 }
717
718 if (flags & SWP_SIZE)
719 {
720 if (cy != pswpOld->cy)
721 flags |= SWP_MOVE;
722 }
723 else
724 {
725 cx = pswpOld->cx;
726 cy = pswpOld->cy;
727 }
728 y = parentHeight-y-cy;
729
730
731 if ((pswpOld->x == x) && (pswpOld->y == y))
732 flags &= ~SWP_MOVE;
733
734 if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
735 flags &= ~SWP_SIZE;
736 }
737
738 pswp->fl = flags;
739 pswp->cy = cy;
740 pswp->cx = cx;
741 pswp->x = x;
742 pswp->y = y;
743 pswp->hwndInsertBehind = hWinAfter;
744 pswp->hwnd = hWindow;
745 pswp->ulReserved1 = 0;
746 pswp->ulReserved2 = 0;
747}
748//******************************************************************************
749//Position in screen coordinates
750//******************************************************************************
751void OSLibMapWINDOWPOStoSWPFrame(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
752{
753 BOOL fCvt = FALSE;
754
755 HWND hWnd = pwpos->hwnd;
756 HWND hWndInsertAfter = pwpos->hwndInsertAfter;
757 long x = pwpos->x;
758 long y = pwpos->y;
759 long cx = pwpos->cx;
760 long cy = pwpos->cy;
761 UINT fuFlags = pwpos->flags;
762 ULONG parentHeight;
763 POINTL point;
764
765 HWND hWinAfter;
766 ULONG flags = 0;
767 HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
768
769 if (hWndInsertAfter == HWND_TOPMOST_W)
770// hWinAfter = HWND_TOPMOST;
771 hWinAfter = HWND_TOP;
772 else if (hWndInsertAfter == HWND_NOTOPMOST_W)
773// hWinAfter = HWND_NOTOPMOST;
774 hWinAfter = HWND_TOP;
775 else if (hWndInsertAfter == HWND_TOP_W)
776 hWinAfter = HWND_TOP;
777 else if (hWndInsertAfter == HWND_BOTTOM_W)
778 hWinAfter = HWND_BOTTOM;
779 else
780 hWinAfter = (HWND) hWndInsertAfter;
781
782 if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
783 if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
784 if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
785 if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
786 if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
787 if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
788 if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
789 if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
790
791 if (flags & (SWP_MOVE | SWP_SIZE))
792 {
793 point.x = x;
794 point.y = y;
795
796 if(hParent) {
797 parentHeight = OSLibGetWindowHeight(hParent);
798
799 point.y = ScreenHeight-point.y-cy;
800 WinMapWindowPoints(HWND_DESKTOP, hParent, &point, 1);
801 point.y = parentHeight-point.y-cy;
802 }
803 else parentHeight = ScreenHeight;
804
805 x = point.x;
806 y = point.y;
807
808 if (flags & SWP_SIZE)
809 {
810 if (cy != pswpOld->cy)
811 flags |= SWP_MOVE;
812 }
813 else
814 {
815 cx = pswpOld->cx;
816 cy = pswpOld->cy;
817 }
818 y = parentHeight-y-cy;
819
820
821 if ((pswpOld->x == x) && (pswpOld->y == y))
822 flags &= ~SWP_MOVE;
823
824 if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
825 flags &= ~SWP_SIZE;
826 }
827
828 pswp->fl = flags;
829 pswp->cy = cy;
830 pswp->cx = cx;
831 pswp->x = x;
832 pswp->y = y;
833 pswp->hwndInsertBehind = hWinAfter;
834 pswp->hwnd = hWindow;
835 pswp->ulReserved1 = 0;
836 pswp->ulReserved2 = 0;
837}
838//******************************************************************************
839//******************************************************************************
840BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient)
841{
842 BOOL rc;
843
844 WinMapWindowPoints(hwndFrame, HWND_DESKTOP, (PPOINTL)pRect, 2);
845
846 rc = WinCalcFrameRect(hwndFrame, (PRECTL)pRect, fClient);
847 WinMapWindowPoints(HWND_DESKTOP, hwndFrame, (PPOINTL)pRect, 2);
848
849 return rc;
850}
851//******************************************************************************
852//******************************************************************************
853BOOL OSLibGetMinMaxInfo(HWND hwndFrame, MINMAXINFO *pMinMax)
854{
855 TRACKINFO tinfo;
856
857 memset(&tinfo, 0, sizeof(TRACKINFO));
858 WinSendMsg(hwndFrame, WM_QUERYTRACKINFO, (MPARAM)0,(MPARAM)&tinfo);
859
860 pMinMax->ptMinTrackSize.x = tinfo.ptlMinTrackSize.x;
861 pMinMax->ptMinTrackSize.y = tinfo.ptlMinTrackSize.y;
862 pMinMax->ptMaxTrackSize.x = tinfo.ptlMaxTrackSize.x;
863 pMinMax->ptMaxTrackSize.y = tinfo.ptlMaxTrackSize.y;
864 return TRUE;
865}
866//******************************************************************************
867//******************************************************************************
868HWND OSLibWinBeginEnumWindows(HWND hwnd)
869{
870 if(hwnd == OSLIB_HWND_DESKTOP) hwnd = HWND_DESKTOP;
871 else
872 if(hwnd == OSLIB_HWND_OBJECT) hwnd = HWND_OBJECT;
873
874 return WinBeginEnumWindows(hwnd);
875}
876//******************************************************************************
877//******************************************************************************
878HWND OSLibWinGetNextWindow(HWND hwndEnum)
879{
880 return WinGetNextWindow(hwndEnum);
881}
882//******************************************************************************
883//******************************************************************************
884HWND OSLibWinQueryClientWindow(HWND hwndFrame)
885{
886 HWND hwndClient = 0;
887
888 if(((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, NULL, NULL)) & FI_FRAME)
889 hwndClient = WinWindowFromID(hwndFrame, FID_CLIENT);
890
891 return hwndClient;
892}
893//******************************************************************************
894//******************************************************************************
895BOOL OSLibWinEndEnumWindows(HWND hwndEnum)
896{
897 return WinEndEnumWindows(hwndEnum);
898}
899//******************************************************************************
900//******************************************************************************
901BOOL OSLibWinQueryWindowProcess(HWND hwnd, ULONG *pid, ULONG *tid)
902{
903 return WinQueryWindowProcess(hwnd, pid, tid);
904}
905//******************************************************************************
906//******************************************************************************
907BOOL OSLibWinMapWindowPoints (HWND hwndFrom, HWND hwndTo, OSLIBPOINT *pptl, ULONG num)
908{
909 return WinMapWindowPoints (hwndFrom, hwndTo, (PPOINTL)pptl, num);
910}
911//******************************************************************************
912//******************************************************************************
913BOOL OSLibWinEnableScrollBar(HWND hwndParent, int scrollBar, BOOL fEnable)
914{
915 HWND hwndScroll;
916
917 if(scrollBar == OSLIB_VSCROLL) {
918 hwndScroll = WinWindowFromID(hwndParent, FID_VERTSCROLL);
919 }
920 else hwndScroll = WinWindowFromID(hwndParent, FID_HORZSCROLL);
921
922 if(hwndScroll == NULL)
923 return FALSE;
924
925 return WinEnableWindow(hwndScroll, fEnable);
926}
927//******************************************************************************
928//******************************************************************************
929HWND OSLibWinQueryObjectWindow(VOID)
930{
931 return WinQueryObjectWindow(HWND_DESKTOP);
932}
933//******************************************************************************
934//******************************************************************************
935ULONG OSLibWinGetScrollPos(HWND hwndParent, HWND hwndScroll)
936{
937 if(hwndScroll == NULL)
938 return 0;
939
940 return (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
941}
942//******************************************************************************
943//******************************************************************************
944ULONG OSLibWinSetScrollPos(HWND hwndParent, HWND hwndScroll, int pos, int fRedraw)
945{
946 ULONG oldPos;
947
948 if(hwndScroll == NULL)
949 return 0;
950
951 oldPos = (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
952
953 if(WinSendMsg(hwndScroll, SBM_SETPOS, MPFROMSHORT(pos), MPFROMLONG(fRedraw)) == FALSE)
954 return 0;
955
956 return oldPos;
957}
958//******************************************************************************
959//******************************************************************************
960BOOL OSLibWinSetScrollRange(HWND hwndParent, HWND hwndScroll, int minpos,
961 int maxpos, int fRedraw)
962{
963 if(hwndScroll == NULL)
964 return 0;
965
966 return (BOOL)WinSendMsg( hwndScroll, SBM_SETSCROLLBAR,
967 MPFROMLONG(WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0)),
968 MPFROM2SHORT( minpos ,maxpos ) );
969}
970//******************************************************************************
971//******************************************************************************
972BOOL OSLibWinSetScrollPageSize(HWND hwndParent, HWND hwndScroll, int pagesize,
973 int totalsize, int fRedraw)
974{
975 if(hwndScroll == NULL)
976 return 0;
977
978 return (BOOL)WinSendMsg( hwndScroll, SBM_SETTHUMBSIZE,
979 MPFROM2SHORT(pagesize, totalsize),
980 0);
981}
982//******************************************************************************
983//******************************************************************************
984void OSLibTranslateScrollCmdAndMsg(ULONG *msg, ULONG *scrollcmd)
985{
986 switch(*scrollcmd)
987 {
988 case SB_LINEUP:
989 *scrollcmd = SB_LINEUP_W;
990 break;
991 case SB_LINEDOWN:
992 *scrollcmd = SB_LINEDOWN_W;
993 break;
994 case SB_PAGEUP:
995 *scrollcmd = SB_PAGEUP_W;
996 break;
997 case SB_PAGEDOWN:
998 *scrollcmd = SB_PAGEDOWN_W;
999 break;
1000 case SB_SLIDERTRACK:
1001 *scrollcmd = SB_THUMBTRACK_W;
1002 break;
1003 case SB_SLIDERPOSITION:
1004 *scrollcmd = SB_THUMBPOSITION_W;
1005 break;
1006 case SB_ENDSCROLL:
1007 *scrollcmd = SB_ENDSCROLL_W;
1008 break;
1009 }
1010 *msg = (*msg == WM_HSCROLL) ? WM_HSCROLL_W : WM_VSCROLL_W;
1011 return;
1012}
1013//******************************************************************************
1014//******************************************************************************
1015void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle, BOOL fTaskList)
1016{
1017 ULONG OSWinStyle, OSFrameStyle, borderWidth, borderHeight,dwExStyle;
1018
1019 OSLibWinConvertStyle(dwStyle, &dwExStyle, &OSWinStyle, &OSFrameStyle, &borderWidth, &borderHeight);
1020
1021 if(fTaskList)
1022 {
1023 OSFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
1024 }
1025
1026// OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
1027 OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN);
1028
1029 WinSetWindowULong(hwnd, QWL_STYLE,
1030 (WinQueryWindowULong(hwnd, QWL_STYLE) & ~0xffff0000) |
1031 OSWinStyle);
1032
1033 if(OSFrameStyle & FCF_TITLEBAR)
1034 {
1035 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_TITLEBAR), hwnd, FALSE);
1036 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MENU), hwnd, FALSE);
1037 }
1038 else
1039 {
1040 WinSetParent(WinWindowFromID(hwnd, FID_TITLEBAR), HWND_OBJECT, FALSE);
1041 WinSetParent(WinWindowFromID(hwnd, FID_MENU), HWND_OBJECT, FALSE);
1042 }
1043 if(OSFrameStyle & FCF_SYSMENU)
1044 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_SYSMENU), hwnd, FALSE);
1045 else
1046 WinSetParent(WinWindowFromID(hwnd, FID_SYSMENU), HWND_OBJECT, FALSE);
1047
1048 if((OSFrameStyle & FCF_MINBUTTON) || (OSFrameStyle & FCF_MAXBUTTON))
1049 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MINMAX), hwnd, FALSE);
1050 else
1051 WinSetParent(WinWindowFromID(hwnd, FID_MINMAX), HWND_OBJECT, FALSE);
1052
1053 if(OSFrameStyle & FCF_VERTSCROLL)
1054 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_VERTSCROLL), hwnd, FALSE);
1055 else
1056 WinSetParent(WinWindowFromID(hwnd, FID_VERTSCROLL), HWND_OBJECT, FALSE);
1057
1058 if(OSFrameStyle & FCF_HORZSCROLL)
1059 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_HORZSCROLL), hwnd, FALSE);
1060 else
1061 WinSetParent(WinWindowFromID(hwnd, FID_HORZSCROLL), HWND_OBJECT, FALSE);
1062
1063#if 0
1064 WNDPARAMS wndparam = {0};
1065 FRAMECDATA framecdata = {0};
1066
1067 framecdata.cb = sizeof(FRAMECDATA);
1068
1069 wndparam.fsStatus = WPM_CTLDATA;
1070 wndparam.cbCtlData = framecdata.cb;
1071 wndparam.pCtlData = (PVOID)&framecdata;
1072 WinSendMsg(hwnd, WM_QUERYWINDOWPARAMS, &wndparam, 0);
1073
1074 wndparam.fsStatus = WPM_CTLDATA;
1075 wndparam.pCtlData = (PVOID)&framecdata;
1076 framecdata.flCreateFlags = OSFrameStyle;
1077 WinSendMsg(hwnd, WM_SETWINDOWPARAMS, &wndparam, 0);
1078#endif
1079
1080 WinSendMsg(hwnd, WM_UPDATEFRAME,
1081 MPFROMLONG(FCF_TITLEBAR | FCF_SYSMENU | FCF_MINMAX |
1082 FCF_MENU | FCF_VERTSCROLL | FCF_HORZSCROLL),
1083 MPVOID);
1084}
1085//******************************************************************************
1086//******************************************************************************
1087HWND OSLibWinObjectWindowFromID(HWND hwndOwner, ULONG ID)
1088{
1089 HWND hwndNext, hwndFound=0;
1090 HENUM henum;
1091
1092 henum = WinBeginEnumWindows(HWND_OBJECT);
1093 while ((hwndNext = WinGetNextWindow(henum)) != 0)
1094 {
1095 if(WinQueryWindow(hwndNext, QW_OWNER) == hwndOwner &&
1096 WinQueryWindowUShort(hwndNext, QWS_ID) == ID)
1097 {
1098 hwndFound = hwndNext;
1099 break;
1100 }
1101 }
1102 WinEndEnumWindows(henum);
1103 return hwndFound;
1104}
1105//******************************************************************************
1106//******************************************************************************
1107BOOL OSLibSetWindowID(HWND hwnd, ULONG value)
1108{
1109 dprintf(("OSLibSetWindowID hwnd:%x ID:%x", hwnd, value));
1110 return WinSetWindowULong(hwnd, QWS_ID, value);
1111}
1112//******************************************************************************
1113//******************************************************************************
1114PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc)
1115{
1116 return WinSubclassWindow(hwnd,(PFNWP)newWndProc);
1117}
1118//******************************************************************************
1119//******************************************************************************
1120BOOL OSLibSetWindowRestoreRect(HWND hwnd, PRECT pRect)
1121{
1122 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
1123
1124 WinSetWindowUShort(hwnd, QWS_XRESTORE, (USHORT)pRect->left );
1125 WinSetWindowUShort(hwnd, QWS_YRESTORE, (USHORT)(yHeight - pRect->top -
1126 (pRect->bottom - pRect->top)));
1127 WinSetWindowUShort(hwnd, QWS_CXRESTORE, (USHORT)(pRect->right - pRect->left));
1128 WinSetWindowUShort(hwnd, QWS_CYRESTORE, (USHORT)(pRect->bottom - pRect->top));
1129 return TRUE;
1130}
1131//******************************************************************************
1132//******************************************************************************
1133BOOL OSLibSetWindowMinPos(HWND hwnd, ULONG x, ULONG y)
1134{
1135 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
1136
1137 WinSetWindowUShort(hwnd, QWS_XMINIMIZE, (USHORT)x );
1138 WinSetWindowUShort(hwnd, QWS_YMINIMIZE, (USHORT)(yHeight - y -
1139 ( 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER)) -
1140 WinQuerySysValue( HWND_DESKTOP, SV_CYICON)));
1141 return TRUE;
1142}
1143//******************************************************************************
1144//******************************************************************************
1145BOOL OSLibWinGetKeyboardStateTable(unsigned char *PMKeyState)
1146{
1147 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, FALSE );
1148}
1149//******************************************************************************
1150//******************************************************************************
1151BOOL OSLibWinSetKeyboardStateTable(unsigned char *PMKeyState)
1152{
1153 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, TRUE );
1154}
1155//******************************************************************************
1156//******************************************************************************
1157BOOL OSLibWinEnableWindowUpdate(HWND hwnd,BOOL fEnable)
1158{
1159 return WinEnableWindowUpdate(hwnd,fEnable);
1160}
1161//******************************************************************************
1162//******************************************************************************
1163ULONG OSLibWinGetLastError()
1164{
1165 return WinGetLastError(GetThreadHAB()) & 0xFFFF;
1166}
Note: See TracBrowser for help on using the repository browser.