source: trunk/mainwin.cpp@ 170

Last change on this file since 170 was 170, checked in by Gregg Young, 3 weeks ago

Rework Gotcha's dialogs to work better with the new font sizing in WPS. Replace some global variables with more C++ alternatives

  • Property svn:eol-style set to native
File size: 21.3 KB
Line 
1/***
2 This file belongs to the Gotcha! distribution.
3 Copyright (C) 1998-2002 Thorsten Thielen <thth@c2226.de>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***/
19
20// ** CreateMainWindow **************************************************** /*FOLD00*/
21
22HWND CreateMainWindow (VOID)
23{
24#ifdef _QUIET_
25 hwndFrame = WinLoadDlg (HWND_OBJECT, NULLHANDLE, NULL, GETMODULE,
26 ID_DLG_MAIN, NULL);
27#else
28 hwndFrame = WinLoadDlg (HWND_DESKTOP, NULLHANDLE, NULL, GETMODULE,
29 ID_DLG_MAIN, NULL);
30#endif
31 OldFrameWP = WinSubclassWindow (hwndFrame, FrameProcedure);
32#ifndef _QUIET_
33 // attach the icon
34 if (HPOINTER hicon = WinLoadPointer (HWND_DESKTOP, GETMODULE, 1))
35 WinSendMsg (hwndFrame, WM_SETICON, MPFROMLONG (hicon), NULL);
36
37 // attach the accelerator table
38 if (HACCEL haccel = WinLoadAccelTable (hab, GETMODULE, 1))
39 WinSetAccelTable (hab, haccel, hwndFrame);
40#endif
41
42 HWND hwnd = WinWindowFromID (hwndFrame, FID_CLIENT);
43
44 // select the radio button
45 switch (pset->QuerySaveStyle ())
46 {
47 case SAVESTYLE_CLIPBOARD:
48 WinSendDlgItemMsg (hwnd, WID_RB_CLIPBOARD, BM_CLICK,
49 MPFROMSHORT (TRUE), 0); break;
50 default:
51 WinSendDlgItemMsg (hwnd, WID_RB_FILE, BM_CLICK,
52 MPFROMSHORT (TRUE), 0); break;
53 }
54 AdjustSaveTypeButtons (BOOL (pset->QueryFileSaveStyle ()==FSS_FORCEFILE));
55
56 if (pset->SerialCapture ())
57 WinEnableWindow (WinWindowFromID (hwnd, WID_CB_DELAYEDCAPTURE), FALSE);
58
59 // adjust the other buttons
60 WinSendDlgItemMsg (hwnd, WID_CB_HIDEWINDOW, BM_SETCHECK,
61 MPFROMLONG (pset->HideWindow ()), MPFROMLONG (0));
62 WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
63 MPFROMLONG (pset->DelayedCapture ()), MPFROMLONG (0));
64 return hwndFrame;
65}
66
67// ** Drag **************************************************************** /*FOLD00*/
68
69VOID Drag (HWND hwnd)
70{
71 // determine the new window position
72 TRACKINFO trackinfo ;
73 memset (&trackinfo, 0, sizeof (trackinfo));
74
75 trackinfo.cxBorder = 1;
76 trackinfo.cyBorder = 1;
77 trackinfo.cxGrid = 1;
78 trackinfo.cyGrid = 1;
79 trackinfo.cxKeyboard = 8;
80 trackinfo.cyKeyboard = 8;
81
82 SWP swp;
83 WinQueryWindowPos (hwnd, &swp);
84 trackinfo.rclTrack.xLeft = swp.x;
85 trackinfo.rclTrack.xRight = swp.x + swp.cx;
86 trackinfo.rclTrack.yBottom = swp.y;
87 trackinfo.rclTrack.yTop = swp.y + swp.cy;
88
89 WinQueryWindowPos (HWND_DESKTOP, &swp);
90 trackinfo.rclBoundary.xLeft = swp.x;
91 trackinfo.rclBoundary.xRight = swp.x + swp.cx;
92 trackinfo.rclBoundary.yBottom = swp.y;
93 trackinfo.rclBoundary.yTop = swp.y + swp.cy;
94
95 trackinfo.ptlMinTrackSize.x = 0;
96 trackinfo.ptlMinTrackSize.y = 0;
97 trackinfo.ptlMaxTrackSize.x = swp.cx;
98 trackinfo.ptlMaxTrackSize.y = swp.cy;
99
100 trackinfo.fs = TF_MOVE | TF_STANDARD | TF_ALLINBOUNDARY;
101
102 if (WinTrackRect (HWND_DESKTOP, 0, &trackinfo))
103 WinSetWindowPos (hwnd, 0, trackinfo.rclTrack.xLeft,
104 trackinfo.rclTrack.yBottom, 0, 0, SWP_MOVE);
105}
106
107// ** FrameProcedure ****************************************************** /*FOLD00*/
108
109MRESULT EXPENTRY FrameProcedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
110{
111 // ATTENTION: used by both main & snapshot window!
112
113 switch (msg)
114 {
115 case WM_QUERYTRACKINFO:
116 {
117 OldFrameWP (hwnd, msg, mp1, mp2);
118 PTRACKINFO pti = PTRACKINFO (mp2);
119 pti->ptlMinTrackSize.x = pti->ptlMinTrackSize.y = 16;
120 }
121 return MRESULT (TRUE);
122
123 case WM_WINDOWPOSCHANGED:
124 if ((PSWP (mp1)->fl & SWP_HIDE))
125 WinPostMsg (WinWindowFromID (hwnd, FID_CLIENT),
126 UM_WINDOWHIDDEN, 0,0);
127 break;
128 }
129
130 return OldFrameWP (hwnd, msg, mp1, mp2);
131}
132
133// ** WindowProcedure ***************************************************** /*FOLD00*/
134
135MRESULT EXPENTRY WindowProcedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
136{
137 static BOOL fInterior = FALSE;
138 static USHORT usState = STATE_IDLE, usCap;
139 static ULONG ulTimer, ulCountdown;
140 static HWND hwndCap, hwndParent;
141 static RECTL rcl;
142
143#ifdef _DOLOGDEBUG_
144 LogDebug( "MainWin:WindowProcedure:Message 0x%04x", msg );
145#endif
146
147 switch (msg)
148 {
149#ifndef _QUIET_
150 case WM_CREATE:
151#else
152 case WM_INITDLG:
153#endif
154 {
155#ifdef _DOLOGDEBUG_
156 LogDebug( "MainWin:WindowProcedure: WM_CREATE" );
157#endif
158#ifndef _QUIET_
159 USHORT usResID = WinQueryWindowUShort (hwnd, QWS_ID);
160
161 // attach the icon
162 if (HPOINTER hicon = WinLoadPointer (HWND_DESKTOP, GETMODULE, usResID))
163 WinSendMsg (hwnd, WM_SETICON, MPFROMLONG (hicon), MPVOID);
164
165 RECTL rcl;
166 WinQueryWindowRect (hwndFrame, &rcl);
167 WinCalcFrameRect (hwndFrame, &rcl, TRUE);
168 WinSetWindowPos (WinWindowFromID (hwndFrame, FID_CLIENT), HWND_TOP,
169 rcl.xLeft, rcl.yBottom, rcl.xRight - rcl.xLeft,
170 rcl.yTop - rcl.yBottom,
171 SWP_SHOW | SWP_MOVE | SWP_SIZE | SWP_ZORDER);
172#endif
173 HMQ hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
174
175 if (pset->GetLangID() == RU) {
176 WinSetCp(hmq, 866);
177 }
178 else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
179 WinSetCp(hmq, 852);
180 }
181 else {
182 WinSetCp(hmq, 850);
183 }
184#if 0
185 if (pset->GetLangID() == RU || pset->GetLangID() == CZ || pset->GetLangID() == PL) {
186 strcpy(ucFont, "9.Times New Roman MT 30");
187 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
188 }
189 else {
190 strcpy(ucFont, "9.WarpSans");
191 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
192 }
193#endif
194 }
195#ifdef _QUIET_
196 WinSendDlgItemMsg (hwnd, WID_CB_HIDEWINDOW, BM_SETCHECK,
197 MPFROMLONG (TRUE), MPFROMLONG (0));
198 WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
199 MPFROMLONG (pset->DelayedCapture ()),
200 MPFROMLONG (0));
201 WinSetFocus( WinWindowFromID (pset->GethwndPage0(), WID_RB_FILE), FALSE );
202 return MRESULT (FALSE);
203#else
204 break;
205#endif
206
207 case WM_QUIT:
208#ifdef _DOLOGDEBUG_
209 LogDebug( "MainWin:WindowProcedure: WM_QUIT" );
210#endif
211 case WM_SAVEAPPLICATION:
212#ifdef _DOLOGDEBUG_
213 LogDebug( "MainWin:WindowProcedure: WM_SAVEAPPLICATION" );
214#endif
215 case WM_CLOSE:
216#ifdef _DOLOGDEBUG_
217 LogDebug( "MainWin:WindowProcedure: WM_CLOSE" );
218#endif
219 WinSendMsg (hwnd, UM_ADJUSTSETTINGS, 0,0);
220 break;
221
222 case UM_ADJUSTSETTINGS:
223 {
224#ifdef _DOLOGDEBUG_
225 LogDebug( "MainWin:WindowProcedure: UM_ADJUSTSETTINGS" );
226#endif
227 if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_CLIPBOARD),
228 BM_QUERYCHECK, 0,0))
229 pset->SetSaveStyle (SAVESTYLE_CLIPBOARD);
230 else
231 pset->SetSaveStyle (SAVESTYLE_FILE);
232
233 BOOL f = FALSE;
234 f = BOOL (WinSendDlgItemMsg (hwnd, WID_CB_HIDEWINDOW,
235 BM_QUERYCHECK, 0, 0));
236 pset->HideWindow (f);
237#ifndef _QUIET_
238 f = BOOL (WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE,
239 BM_QUERYCHECK, 0, 0));
240 pset->DelayedCapture (f);
241#endif
242 }
243 return MRESULT (FALSE);
244
245 case WM_MOUSEMOVE:
246 // we don't want the mouse pointer to be reset so capture this msg
247 return MRESULT (FALSE);
248
249#ifndef _QUIET_
250 case WM_PAINT:
251 {
252 HPS hps;
253 RECTL rcl;
254 COLOR color = SYSCLR_DIALOGBACKGROUND;
255
256 HWND hwnd2 = WinWindowFromID (hwnd, WID_RB_CLIPBOARD);
257 WinQueryPresParam (hwnd2, PP_BACKGROUNDCOLOR, 0, NULL,
258 sizeof (color), &color, 0L);
259
260 hps = WinBeginPaint (hwnd, NULLHANDLE, &rcl);
261 WinQueryWindowRect (hwnd, &rcl);
262 WinFillRect (hps, &rcl, color);
263 WinEndPaint (hps);
264 }
265 break;
266#endif
267
268 case WM_COMMAND:
269#ifdef _DOLOGDEBUG_
270 LogDebug( "MainWin:WindowProcedure: WM_COMMAND" );
271#endif
272 if (usState != STATE_IDLE)
273 {
274 //Attempt to open settings probably a hang
275 if (SHORT1FROMMP (mp1) == WID_PB_SETTINGS) {
276 WinSendMsg (hwnd, UM_ABORT, 0,0);
277 pset->Dialog ();
278 }
279 // this means ESC was pressed
280 else if (SHORT1FROMMP (mp1) == DID_CANCEL)
281 WinSendMsg (hwnd, UM_ABORT, MPFROMLONG(1),0);
282 return MRESULT (FALSE);
283 }
284#ifndef _QUIET_
285 else
286 // FIXME pretty yukki to do it this way I guess ...
287 WinSendMsg (hwnd, UM_ADJUSTSETTINGS, 0,0);
288#endif
289 switch (SHORT1FROMMP (mp1))
290 {
291 case WID_RB_CLIPBOARD:
292 WinSendDlgItemMsg (hwnd, WID_RB_CLIPBOARD, BM_CLICK,
293 MPFROMSHORT (TRUE), PVOID (0));
294 break;
295 case WID_RB_FILE:
296 WinSendDlgItemMsg (hwnd, WID_RB_FILE, BM_CLICK,
297 MPFROMSHORT (TRUE), PVOID (0));
298 break;
299 case WID_CB_HIDEWINDOW:
300 WinSendDlgItemMsg (hwnd, WID_CB_HIDEWINDOW, BM_CLICK,
301 MPFROMSHORT (TRUE), PVOID (0));
302 break;
303 case WID_CB_DELAYEDCAPTURE:
304 WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE, BM_CLICK,
305 MPFROMSHORT (TRUE), PVOID (0));
306 break;
307#ifndef _QUIET_
308 case WID_PB_ABOUT:
309 AboutBox (hwnd);
310 break;
311#endif
312 case WID_PB_SETTINGS:
313 pset->Dialog ();
314 break;
315
316 case WID_PB_SETCAPTURETYPE:
317 //int capType;
318 if (LONGFROMMP(mp2) == 1) {
319 pset->SetSaveStyle (SAVESTYLE_CLIPBOARD);
320 }
321
322 switch (pset->QuerySSWCaptureType ())
323 {
324 case CAP_WINDOWINT:
325 WinSendMsg (hwndFrame, WM_COMMAND,
326 MPFROM2SHORT (WID_PB_WINDOWINTERIOR,0), 0);
327 case CAP_SCREENREGION:
328 WinSendMsg (hwndFrame, WM_COMMAND,
329 MPFROM2SHORT (WID_PB_SCREENREGION,0), 0);
330 case CAP_WINDOW:
331 WinSendMsg (hwndFrame, WM_COMMAND,
332 MPFROM2SHORT (WID_PB_WINDOW,0), 0);
333 default:
334 WinSendMsg (hwndFrame, WM_COMMAND,
335 MPFROM2SHORT (WID_PB_SCREEN,0), 0);
336 }
337 break;
338
339 case WID_PB_SCREEN:
340 usCap = CAP_SCREEN;
341#ifdef _QUIET_
342 WinShowWindow (pset->GethwndSettingsDialog(), FALSE);
343#endif
344 WinSendMsg (hwnd, UM_PREPARECAPTURE, 0,0);
345 break;
346
347 case WID_PB_SCREENREGION:
348 usCap = CAP_SCREENREGION;
349#ifdef _QUIET_
350 WinShowWindow (pset->GethwndSettingsDialog(), FALSE);
351#endif
352 WinSendMsg (hwnd, UM_PREPARECAPTURE, 0,0);
353 break;
354
355 case WID_PB_WINDOWINTERIOR:
356 usCap = CAP_WINDOWINT;
357#ifdef _QUIET_
358 WinShowWindow (pset->GethwndSettingsDialog(), FALSE);
359#endif
360 WinSendMsg (hwnd, UM_PREPARECAPTURE, 0,0);
361 break;
362
363 case WID_PB_WINDOW:
364 usCap = CAP_WINDOW;
365#ifdef _QUIET_
366 WinShowWindow (pset->GethwndSettingsDialog(), FALSE);
367#endif
368 WinSendMsg (hwnd, UM_PREPARECAPTURE, 0,0);
369 break;
370
371 case WID_PB_EXIT:
372 WinSendMsg (WinWindowFromID (hwndFrame, FID_CLIENT),
373 WM_CLOSE, 0,0);
374 break;
375
376 case HM_HELP_CONTENTS: g_phelp->DisplayContents (); break;
377 case HM_HELP_INDEX: g_phelp->DisplayIndex (); break;
378 case HM_KEYS_HELP: g_phelp->DisplayKeysHelp (); break;
379
380 case HM_GENERAL_HELP:
381 g_phelp->DisplayGeneralHelp ();
382 break;
383
384 default:
385 break;
386 }
387 return MRESULT (FALSE);
388
389 case UM_PREPARECAPTURE:
390 WinSendMsg (hwndSnapshot, UM_STARTCAPTURE, 0,0);
391 usState = STATE_WAITFORHIDE;
392
393 if (usCap == CAP_SCREENREGION || usCap == CAP_SCREEN) {
394#ifdef _QUIET_
395 hwndParent = WinQueryFocus(HWND_DESKTOP);
396#else
397 hwndParent = WinQueryWindow(hwndFrame, QW_NEXTTOP );
398#endif
399 }
400#ifndef _QUIET_
401 if (WinQueryButtonCheckstate (hwnd, WID_CB_HIDEWINDOW)) {
402 WinShowWindow (WinQueryWindow (hwnd, QW_PARENT), FALSE);
403 }
404 else
405#endif
406 WinPostMsg (hwnd, UM_WINDOWHIDDEN, 0,0);
407 return MRESULT (FALSE);
408
409 case UM_WINDOWHIDDEN:
410 if (usState == STATE_WAITFORHIDE)
411 {
412 // FIXME
413 // I have no idea why this delay is necessary, but CAP_SCREEN with
414 // hiding our window does not work without it ...
415 DosSleep (100);
416 usState = STATE_SELECTWINDOW;
417 WinSendMsg (hwnd, UM_SELECTWINDOW, 0,0);
418 }
419 return MRESULT (FALSE);
420
421 case UM_SELECTWINDOW:
422 switch (usCap)
423 {
424 case CAP_SCREEN:
425 usState = STATE_WINDOWSELECTED;
426 WinPostMsg (hwnd, UM_WINDOWSELECTED,
427 MPFROMHWND (HWND_DESKTOP),
428 MPFROMHWND (HWND_DESKTOP));
429 break;
430
431 case CAP_SCREENREGION:
432#ifdef _QUIET_
433 WinSetFocus(HWND_DESKTOP, hwnd);
434#endif
435 if (DoTracking (&rcl))
436 {
437 usState = STATE_WINDOWSELECTED;
438 WinPostMsg (hwnd, UM_WINDOWSELECTED,
439 MPFROMHWND (HWND_DESKTOP),
440 MPFROMHWND (HWND_DESKTOP));
441 }
442 else
443 usState = STATE_IDLE;
444 break;
445
446 case CAP_WINDOWINT:
447 fInterior = TRUE;
448#ifdef _QUIET_
449 WinSetFocus(HWND_DESKTOP, hwnd);
450#endif
451 StartSelection (hwnd);
452 break;
453
454 case CAP_WINDOW:
455 fInterior = FALSE;
456#ifdef _QUIET_
457 WinSetFocus(HWND_DESKTOP, hwnd);
458#endif
459 StartSelection (hwnd);
460 break;
461
462 default:
463 usState = STATE_IDLE;
464 break;
465 }
466 return MRESULT (FALSE);
467
468 case WM_BUTTON1UP:
469 if (usState != STATE_SELECTWINDOW)
470 return MRESULT (FALSE);
471 else
472 {
473 POINTL ptl;
474 WinQueryPointerPos (HWND_DESKTOP, &ptl);
475 HWND hwndCapture =
476 WinWindowFromPoint (HWND_DESKTOP, &ptl, FALSE);
477
478 if (hwndCapture && (hwndCapture != HWND_DESKTOP))
479 {
480 HWND hwndOld = hwndCapture;
481
482 if (fInterior)
483 if (! (hwndCapture = WinWindowFromID (hwndOld,
484 FID_CLIENT)))
485 hwndCapture = WinQueryWindow (hwndOld, QW_BOTTOM);
486
487 if (hwndCapture && (hwndCapture != HWND_DESKTOP))
488 {
489 usState = STATE_WINDOWSELECTED;
490 WinPostMsg (hwnd, UM_WINDOWSELECTED,
491 MPFROMHWND (hwndCapture),
492 MPFROMHWND (hwndOld));
493 }
494 else
495 usState = STATE_IDLE;
496 }
497 else
498 usState = STATE_IDLE;
499 }
500 return MRESULT (FALSE);
501
502 case UM_WINDOWSELECTED:
503 if (usState == STATE_WINDOWSELECTED)
504 {
505 // release the pointing device capture if it is active
506 if (WinQueryCapture (HWND_DESKTOP) == hwnd)
507 WinSetCapture (HWND_DESKTOP, NULLHANDLE);
508
509 // reset the pointer to normal shape
510 WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP,
511 SPTR_ARROW,
512 FALSE));
513 hwndCap = HWND (mp1);
514 if (usCap != CAP_SCREENREGION && usCap != CAP_SCREEN)
515 hwndParent = HWND (mp2);
516 if (pset->SerialCapture ())
517 {
518 ulTimer = WinStartTimer (hab, hwnd, 1, 49);
519 ulCountdown = pset->QuerySerialTime ();
520 }
521 else if (WinQueryButtonCheckstate (hwnd, WID_CB_DELAYEDCAPTURE))
522 {
523 ulTimer = WinStartTimer (hab, hwnd, 1, 990);
524 ulCountdown = pset->QueryDelayTime ();
525 }
526 else
527 {
528 usState = STATE_CAPTURE;
529 WinPostMsg (hwnd, UM_CAPTURE, 0,0);
530 }
531 }
532 return MRESULT (FALSE);
533
534 case WM_TIMER:
535 ulCountdown --;
536#ifndef _QUIET_
537 if( ulCountdown % 20 == 0 )
538 WinSendMsg (hwndSnapshot, UM_COUNTDOWN,
539 MPFROMLONG (ulCountdown), 0);
540#endif
541 if (pset->DelayCountdown () && !pset->SerialCapture ())
542 DoCountdown (ulCountdown);
543
544 if (ulCountdown == 0)
545 {
546 WinStopTimer (hab, hwnd, ulTimer);
547 usState = STATE_CAPTURE;
548 WinSendMsg (hwnd, UM_CAPTURE, 0,0);
549 }
550 return MRESULT (FALSE);
551
552 case UM_CAPTURE:
553 usState = STATE_WAITFORHIDE2;
554#ifndef _QUIET_
555 if (pset->SSWHide () && WinIsWindowVisible (hwndSnapshot))
556 WinShowWindow (hwndSnapshot, FALSE);
557 else
558#endif
559 WinSendMsg (hwnd, UM_CAPTURE2, 0,0);
560 return MRESULT (FALSE);
561
562 case UM_SSWHIDDEN:
563 // FIXME
564 // I have no idea why this delay is necessary, but CAP_SCREEN with
565 // hiding our window does not work without it ...
566 DosSleep (100);
567 WinSendMsg (hwnd, UM_CAPTURE2, 0,0);
568 return MRESULT (FALSE);
569
570 case UM_CAPTURE2:
571 if (usState == STATE_WAITFORHIDE2)
572 {
573 HBITMAP hbm;
574
575 WinEnableWindow (hwnd, FALSE);
576 // capture the window to a bitmap and save this
577 if (usCap == CAP_SCREENREGION)
578 hbm = CaptureWindow (hwndCap, hwndParent, &rcl, FALSE);
579 else if (usCap == CAP_SCREEN)
580 hbm = CaptureWindow (hwndCap, hwndParent, NULL, FALSE);
581 else
582 hbm = CaptureWindow (hwndCap, hwndParent, NULL, TRUE);
583
584 if (pset->SerialCapture ())
585 {
586 WinStopTimer (hab, hwnd, ulTimer);
587#ifndef _QUIET_
588 if (! WinIsWindowVisible (hwndSnapshot) && pset->SnapshotWindow ())
589 WinShowWindow (hwndSnapshot, TRUE);
590#endif
591 if (hbm)
592 {
593 usState = STATE_WINDOWSELECTED;
594 WinPostMsg (hwnd, UM_WINDOWSELECTED,
595 MPFROMHWND (hwndCap),
596 MPFROMHWND (hwndParent));
597 }
598 else
599 WinSendMsg (hwnd, UM_ABORT, 0,0);
600 }
601 else
602 WinSendMsg (hwnd, UM_CLEANUP, 0,0);
603 }
604 return MRESULT (FALSE);
605
606 case UM_ABORT:
607 if (LONGFROMMP(mp1) != 1)
608 DosBeep (75, 200);
609 WinSendMsg (hwnd, UM_CLEANUP, 0,0);
610 return MRESULT (FALSE);
611
612 case UM_CLEANUP:
613 if (WinQueryCapture (HWND_DESKTOP) == hwnd)
614 WinSetCapture (HWND_DESKTOP, NULLHANDLE);
615
616 pset->Load ();
617
618 WinSendMsg (hwndSnapshot, UM_STOPCAPTURE, 0,0);
619 WinStopTimer (hab, hwnd, ulTimer);
620#ifdef _QUIET_
621 // ? FIXME to give option to reshow window.
622 if (WinQueryButtonCheckstate (hwnd, WID_CB_HIDEWINDOW))
623 WinSendMsg (pset->GethwndSettingsDialog(), WM_CLOSE, 0,0);
624 else if (WinIsWindow ( hab, pset->GethwndSettingsDialog()) &&
625 ! WinIsWindowVisible (pset->GethwndSettingsDialog()))
626 WinShowWindow (pset->GethwndSettingsDialog(), TRUE);
627 pset->HideWindow (TRUE);
628#else
629 // re-show the windows if they are hidden
630 // FIXME using global hwndFrame is pretty yukki
631 if (! WinIsWindowVisible (hwndFrame))
632 WinShowWindow (hwndFrame, TRUE);
633 if (! WinIsWindowVisible (hwndSnapshot) && pset->SnapshotWindow ())
634 WinShowWindow (hwndSnapshot, TRUE);
635#endif
636 WinEnableWindow (hwnd, TRUE);
637 WinSetActiveWindow (HWND_DESKTOP, hwnd);
638 usState = STATE_IDLE;
639 WinSetFocus(HWND_DESKTOP, hwndParent);
640 return MRESULT (FALSE);
641 }
642
643#ifdef _DOLOGDEBUG_
644 LogDebug( "MainWin:WindowProcedure:WinDefWindowProc->0x%04x", msg );
645#endif
646 if (hwnd == pset->GethwndPage0())
647 return WinDefDlgProc (hwnd, msg, mp1, mp2);
648 else
649 return WinDefWindowProc (hwnd, msg, mp1, mp2);
650}
651
652// ************************************************************************
Note: See TracBrowser for help on using the repository browser.