source: trunk/mainwin.cpp@ 112

Last change on this file since 112 was 112, checked in by Gregg Young, 4 years ago

Remove dead code

  • Property svn:eol-style set to native
File size: 21.4 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;
174 BOOL bUniCodeFont = FALSE;
175 CHAR ucFont[FACESIZE];
176
177 if (pset->GetLangID() == RU) {
178 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
179 WinSetCp(hmq, 866);
180 bUniCodeFont = TRUE;
181 }
182 else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
183 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
184 WinSetCp(hmq, 852);
185 bUniCodeFont = TRUE;
186 }
187 else {
188 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
189 WinSetCp(hmq, 850);
190 }
191
192 if (pset->GetLangID() == RU || pset->GetLangID() == CZ || pset->GetLangID() == PL) {
193 strcpy(ucFont, "9.Times New Roman MT 30");
194 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
195 }
196 else {
197 strcpy(ucFont, "9.WarpSans");
198 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
199 }
200 }
201#ifdef _QUIET_
202 WinSendDlgItemMsg (hwnd, WID_CB_HIDEWINDOW, BM_SETCHECK,
203 MPFROMLONG (TRUE), MPFROMLONG (0));
204 WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
205 MPFROMLONG (pset->DelayedCapture ()),
206 MPFROMLONG (0));
207 WinSetFocus( WinWindowFromID (g_hwndPage0, WID_RB_FILE), FALSE );
208 return MRESULT (FALSE);
209#else
210 break;
211#endif
212
213 case WM_QUIT:
214#ifdef _DOLOGDEBUG_
215 LogDebug( "MainWin:WindowProcedure: WM_QUIT" );
216#endif
217 case WM_SAVEAPPLICATION:
218#ifdef _DOLOGDEBUG_
219 LogDebug( "MainWin:WindowProcedure: WM_SAVEAPPLICATION" );
220#endif
221 case WM_CLOSE:
222#ifdef _DOLOGDEBUG_
223 LogDebug( "MainWin:WindowProcedure: WM_CLOSE" );
224#endif
225 WinSendMsg (hwnd, UM_ADJUSTSETTINGS, 0,0);
226 break;
227
228 case UM_ADJUSTSETTINGS:
229 {
230#ifdef _DOLOGDEBUG_
231 LogDebug( "MainWin:WindowProcedure: UM_ADJUSTSETTINGS" );
232#endif
233 if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_CLIPBOARD),
234 BM_QUERYCHECK, 0,0))
235 pset->SetSaveStyle (SAVESTYLE_CLIPBOARD);
236 else
237 pset->SetSaveStyle (SAVESTYLE_FILE);
238
239 BOOL f = FALSE;
240 f = BOOL (WinSendDlgItemMsg (hwnd, WID_CB_HIDEWINDOW,
241 BM_QUERYCHECK, 0, 0));
242 pset->HideWindow (f);
243#ifndef _QUIET_
244 f = BOOL (WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE,
245 BM_QUERYCHECK, 0, 0));
246 pset->DelayedCapture (f);
247#endif
248 }
249 return MRESULT (FALSE);
250
251 case WM_MOUSEMOVE:
252 // we don't want the mouse pointer to be reset so capture this msg
253 return MRESULT (FALSE);
254
255#ifndef _QUIET_
256 case WM_PAINT:
257 {
258 HPS hps;
259 RECTL rcl;
260 COLOR color = SYSCLR_DIALOGBACKGROUND;
261
262 HWND hwnd2 = WinWindowFromID (hwnd, WID_RB_CLIPBOARD);
263 WinQueryPresParam (hwnd2, PP_BACKGROUNDCOLOR, 0, NULL,
264 sizeof (color), &color, 0L);
265
266 hps = WinBeginPaint (hwnd, NULLHANDLE, &rcl);
267 WinQueryWindowRect (hwnd, &rcl);
268 WinFillRect (hps, &rcl, color);
269 WinEndPaint (hps);
270 }
271 break;
272#endif
273
274 case WM_COMMAND:
275#ifdef _DOLOGDEBUG_
276 LogDebug( "MainWin:WindowProcedure: WM_COMMAND" );
277#endif
278 if (usState != STATE_IDLE)
279 {
280 //Attempt to open settings probably a hang
281 if (SHORT1FROMMP (mp1) == WID_PB_SETTINGS) {
282 WinSendMsg (hwnd, UM_ABORT, 0,0);
283 pset->Dialog ();
284 }
285 // this means ESC was pressed
286 else if (SHORT1FROMMP (mp1) == DID_CANCEL)
287 WinSendMsg (hwnd, UM_ABORT, MPFROMLONG(1),0);
288 return MRESULT (FALSE);
289 }
290#ifndef _QUIET_
291 else
292 // FIXME pretty yukki to do it this way I guess ...
293 WinSendMsg (hwnd, UM_ADJUSTSETTINGS, 0,0);
294#endif
295 switch (SHORT1FROMMP (mp1))
296 {
297 case WID_RB_CLIPBOARD:
298 WinSendDlgItemMsg (hwnd, WID_RB_CLIPBOARD, BM_CLICK,
299 MPFROMSHORT (TRUE), PVOID (0));
300 break;
301 case WID_RB_FILE:
302 WinSendDlgItemMsg (hwnd, WID_RB_FILE, BM_CLICK,
303 MPFROMSHORT (TRUE), PVOID (0));
304 break;
305 case WID_CB_HIDEWINDOW:
306 WinSendDlgItemMsg (hwnd, WID_CB_HIDEWINDOW, BM_CLICK,
307 MPFROMSHORT (TRUE), PVOID (0));
308 break;
309 case WID_CB_DELAYEDCAPTURE:
310 WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE, BM_CLICK,
311 MPFROMSHORT (TRUE), PVOID (0));
312 break;
313
314 case WID_PB_ABOUT:
315 AboutBox (hwnd);
316 break;
317
318 case WID_PB_SETTINGS:
319 pset->Dialog ();
320 break;
321
322 case WID_PB_SETCAPTURETYPE:
323 //int capType;
324 if (LONGFROMMP(mp2) == 1) {
325 pset->SetSaveStyle (SAVESTYLE_CLIPBOARD);
326 }
327
328 switch (pset->QuerySSWCaptureType ())
329 {
330 case CAP_WINDOWINT:
331 WinSendMsg (hwndFrame, WM_COMMAND,
332 MPFROM2SHORT (WID_PB_WINDOWINTERIOR,0), 0);
333 case CAP_SCREENREGION:
334 WinSendMsg (hwndFrame, WM_COMMAND,
335 MPFROM2SHORT (WID_PB_SCREENREGION,0), 0);
336 case CAP_WINDOW:
337 WinSendMsg (hwndFrame, WM_COMMAND,
338 MPFROM2SHORT (WID_PB_WINDOW,0), 0);
339 default:
340 WinSendMsg (hwndFrame, WM_COMMAND,
341 MPFROM2SHORT (WID_PB_SCREEN,0), 0);
342 }
343 break;
344
345 case WID_PB_SCREEN:
346 usCap = CAP_SCREEN;
347#ifdef _QUIET_
348 WinShowWindow (g_hwndSettingsDialog, FALSE);
349#endif
350 WinSendMsg (hwnd, UM_PREPARECAPTURE, 0,0);
351 break;
352
353 case WID_PB_SCREENREGION:
354 usCap = CAP_SCREENREGION;
355#ifdef _QUIET_
356 WinShowWindow (g_hwndSettingsDialog, FALSE);
357#endif
358 WinSendMsg (hwnd, UM_PREPARECAPTURE, 0,0);
359 break;
360
361 case WID_PB_WINDOWINTERIOR:
362 usCap = CAP_WINDOWINT;
363#ifdef _QUIET_
364 WinShowWindow (g_hwndSettingsDialog, FALSE);
365#endif
366 WinSendMsg (hwnd, UM_PREPARECAPTURE, 0,0);
367 break;
368
369 case WID_PB_WINDOW:
370 usCap = CAP_WINDOW;
371#ifdef _QUIET_
372 WinShowWindow (g_hwndSettingsDialog, FALSE);
373#endif
374 WinSendMsg (hwnd, UM_PREPARECAPTURE, 0,0);
375 break;
376
377 case WID_PB_EXIT:
378 WinSendMsg (WinWindowFromID (hwndFrame, FID_CLIENT),
379 WM_CLOSE, 0,0);
380 break;
381
382 case HM_HELP_CONTENTS: g_phelp->DisplayContents (); break;
383 case HM_HELP_INDEX: g_phelp->DisplayIndex (); break;
384 case HM_KEYS_HELP: g_phelp->DisplayKeysHelp (); break;
385
386 case HM_GENERAL_HELP:
387 g_phelp->DisplayGeneralHelp ();
388 break;
389
390 default:
391 break;
392 }
393 return MRESULT (FALSE);
394
395 case UM_PREPARECAPTURE:
396 WinSendMsg (hwndSnapshot, UM_STARTCAPTURE, 0,0);
397 usState = STATE_WAITFORHIDE;
398
399 if (usCap == CAP_SCREENREGION || usCap == CAP_SCREEN) {
400#ifdef _QUIET_
401 hwndParent = WinQueryFocus(HWND_DESKTOP);
402#else
403 hwndParent = WinQueryWindow(hwndFrame, QW_NEXTTOP );
404#endif
405 }
406#ifndef _QUIET_
407 if (WinQueryButtonCheckstate (hwnd, WID_CB_HIDEWINDOW)) {
408 WinShowWindow (WinQueryWindow (hwnd, QW_PARENT), FALSE);
409 }
410 else
411#endif
412 WinPostMsg (hwnd, UM_WINDOWHIDDEN, 0,0);
413 return MRESULT (FALSE);
414
415 case UM_WINDOWHIDDEN:
416 if (usState == STATE_WAITFORHIDE)
417 {
418 // FIXME
419 // I have no idea why this delay is necessary, but CAP_SCREEN with
420 // hiding our window does not work without it ...
421 DosSleep (100);
422 usState = STATE_SELECTWINDOW;
423 WinSendMsg (hwnd, UM_SELECTWINDOW, 0,0);
424 }
425 return MRESULT (FALSE);
426
427 case UM_SELECTWINDOW:
428 switch (usCap)
429 {
430 case CAP_SCREEN:
431 usState = STATE_WINDOWSELECTED;
432 WinPostMsg (hwnd, UM_WINDOWSELECTED,
433 MPFROMHWND (HWND_DESKTOP),
434 MPFROMHWND (HWND_DESKTOP));
435 break;
436
437 case CAP_SCREENREGION:
438#ifdef _QUIET_
439 WinSetFocus(HWND_DESKTOP, hwnd);
440#endif
441 if (DoTracking (&rcl))
442 {
443 usState = STATE_WINDOWSELECTED;
444 WinPostMsg (hwnd, UM_WINDOWSELECTED,
445 MPFROMHWND (HWND_DESKTOP),
446 MPFROMHWND (HWND_DESKTOP));
447 }
448 else
449 usState = STATE_IDLE;
450 break;
451
452 case CAP_WINDOWINT:
453 fInterior = TRUE;
454#ifdef _QUIET_
455 WinSetFocus(HWND_DESKTOP, hwnd);
456#endif
457 StartSelection (hwnd);
458 break;
459
460 case CAP_WINDOW:
461 fInterior = FALSE;
462#ifdef _QUIET_
463 WinSetFocus(HWND_DESKTOP, hwnd);
464#endif
465 StartSelection (hwnd);
466 break;
467
468 default:
469 usState = STATE_IDLE;
470 break;
471 }
472 return MRESULT (FALSE);
473
474 case WM_BUTTON1UP:
475 if (usState != STATE_SELECTWINDOW)
476 return MRESULT (FALSE);
477 else
478 {
479 POINTL ptl;
480 WinQueryPointerPos (HWND_DESKTOP, &ptl);
481 HWND hwndCapture =
482 WinWindowFromPoint (HWND_DESKTOP, &ptl, FALSE);
483
484 if (hwndCapture && (hwndCapture != HWND_DESKTOP))
485 {
486 HWND hwndOld = hwndCapture;
487
488 if (fInterior)
489 if (! (hwndCapture = WinWindowFromID (hwndOld,
490 FID_CLIENT)))
491 hwndCapture = WinQueryWindow (hwndOld, QW_BOTTOM);
492
493 if (hwndCapture && (hwndCapture != HWND_DESKTOP))
494 {
495 usState = STATE_WINDOWSELECTED;
496 WinPostMsg (hwnd, UM_WINDOWSELECTED,
497 MPFROMHWND (hwndCapture),
498 MPFROMHWND (hwndOld));
499 }
500 else
501 usState = STATE_IDLE;
502 }
503 else
504 usState = STATE_IDLE;
505 }
506 return MRESULT (FALSE);
507
508 case UM_WINDOWSELECTED:
509 if (usState == STATE_WINDOWSELECTED)
510 {
511 // release the pointing device capture if it is active
512 if (WinQueryCapture (HWND_DESKTOP) == hwnd)
513 WinSetCapture (HWND_DESKTOP, NULLHANDLE);
514
515 // reset the pointer to normal shape
516 WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP,
517 SPTR_ARROW,
518 FALSE));
519 hwndCap = HWND (mp1);
520 if (usCap != CAP_SCREENREGION && usCap != CAP_SCREEN)
521 hwndParent = HWND (mp2);
522 if (pset->SerialCapture ())
523 {
524 ulTimer = WinStartTimer (hab, hwnd, 1, 49);
525 ulCountdown = pset->QuerySerialTime ();
526 }
527 else if (WinQueryButtonCheckstate (hwnd, WID_CB_DELAYEDCAPTURE))
528 {
529 ulTimer = WinStartTimer (hab, hwnd, 1, 990);
530 ulCountdown = pset->QueryDelayTime ();
531 }
532 else
533 {
534 usState = STATE_CAPTURE;
535 WinPostMsg (hwnd, UM_CAPTURE, 0,0);
536 }
537 }
538 return MRESULT (FALSE);
539
540 case WM_TIMER:
541 ulCountdown --;
542
543 if( ulCountdown % 20 == 0 )
544 WinSendMsg (hwndSnapshot, UM_COUNTDOWN,
545 MPFROMLONG (ulCountdown), 0);
546 if (pset->DelayCountdown () && !pset->SerialCapture ())
547 DoCountdown (ulCountdown);
548
549 if (ulCountdown == 0)
550 {
551 WinStopTimer (hab, hwnd, ulTimer);
552 usState = STATE_CAPTURE;
553 WinSendMsg (hwnd, UM_CAPTURE, 0,0);
554 }
555 return MRESULT (FALSE);
556
557 case UM_CAPTURE:
558 usState = STATE_WAITFORHIDE2;
559#ifndef _QUIET_
560 if (pset->SSWHide () && WinIsWindowVisible (hwndSnapshot))
561 WinShowWindow (hwndSnapshot, FALSE);
562 else
563#endif
564 WinSendMsg (hwnd, UM_CAPTURE2, 0,0);
565 return MRESULT (FALSE);
566
567 case UM_SSWHIDDEN:
568 // FIXME
569 // I have no idea why this delay is necessary, but CAP_SCREEN with
570 // hiding our window does not work without it ...
571 DosSleep (100);
572 WinSendMsg (hwnd, UM_CAPTURE2, 0,0);
573 return MRESULT (FALSE);
574
575 case UM_CAPTURE2:
576 if (usState == STATE_WAITFORHIDE2)
577 {
578 HBITMAP hbm;
579
580 WinEnableWindow (hwnd, FALSE);
581 // capture the window to a bitmap and save this
582 if (usCap == CAP_SCREENREGION)
583 hbm = CaptureWindow (hwndCap, hwndParent, &rcl, FALSE);
584 else if (usCap == CAP_SCREEN)
585 hbm = CaptureWindow (hwndCap, hwndParent, NULL, FALSE);
586 else
587 hbm = CaptureWindow (hwndCap, hwndParent, NULL, TRUE);
588
589 if (pset->SerialCapture ())
590 {
591 WinStopTimer (hab, hwnd, ulTimer);
592#ifndef _QUIET_
593 if (! WinIsWindowVisible (hwndSnapshot) && pset->SnapshotWindow ())
594 WinShowWindow (hwndSnapshot, TRUE);
595#endif
596 if (hbm)
597 {
598 usState = STATE_WINDOWSELECTED;
599 WinPostMsg (hwnd, UM_WINDOWSELECTED,
600 MPFROMHWND (hwndCap),
601 MPFROMHWND (hwndParent));
602 }
603 else
604 WinSendMsg (hwnd, UM_ABORT, 0,0);
605 }
606 else
607 WinSendMsg (hwnd, UM_CLEANUP, 0,0);
608 }
609 return MRESULT (FALSE);
610
611 case UM_ABORT:
612 if (LONGFROMMP(mp1) != 1)
613 DosBeep (75, 200);
614 WinSendMsg (hwnd, UM_CLEANUP, 0,0);
615 return MRESULT (FALSE);
616
617 case UM_CLEANUP:
618 if (WinQueryCapture (HWND_DESKTOP) == hwnd)
619 WinSetCapture (HWND_DESKTOP, NULLHANDLE);
620
621 pset->Load ();
622
623 WinSendMsg (hwndSnapshot, UM_STOPCAPTURE, 0,0);
624 WinStopTimer (hab, hwnd, ulTimer);
625#ifdef _QUIET_
626 // ? FIXME to give option to reshow window.
627 if (WinQueryButtonCheckstate (hwnd, WID_CB_HIDEWINDOW))
628 WinSendMsg (g_hwndSettingsDialog, WM_CLOSE, 0,0);
629 else if (WinIsWindow ( hab, g_hwndSettingsDialog) &&
630 ! WinIsWindowVisible (g_hwndSettingsDialog))
631 WinShowWindow (g_hwndSettingsDialog, TRUE);
632 pset->HideWindow (TRUE);
633#else
634 // re-show the windows if they are hidden
635 // FIXME using global hwndFrame is pretty yukki
636 if (! WinIsWindowVisible (hwndFrame))
637 WinShowWindow (hwndFrame, TRUE);
638 if (! WinIsWindowVisible (hwndSnapshot) && pset->SnapshotWindow ())
639 WinShowWindow (hwndSnapshot, TRUE);
640#endif
641 WinEnableWindow (hwnd, TRUE);
642 WinSetActiveWindow (HWND_DESKTOP, hwnd);
643 usState = STATE_IDLE;
644 WinSetFocus(HWND_DESKTOP, hwndParent);
645 return MRESULT (FALSE);
646 }
647
648#ifdef _DOLOGDEBUG_
649 LogDebug( "MainWin:WindowProcedure:WinDefWindowProc->0x%04x", msg );
650#endif
651 if (hwnd == g_hwndPage0)
652 return WinDefDlgProc (hwnd, msg, mp1, mp2);
653 else
654 return WinDefWindowProc (hwnd, msg, mp1, mp2);
655}
656
657// ************************************************************************
Note: See TracBrowser for help on using the repository browser.