Changeset 51 for trunk/mainwin.cpp


Ignore:
Timestamp:
Apr 7, 2018, 10:04:50 PM (7 years ago)
Author:
Gregg Young
Message:

Save setting only if OK is selected; Prevent hang where a selected "window" has focus a steals the mouse/keyboard input from Gotcha Quiet; Change the Gotcha Quiet main window from a WINDOW to a DIALOG; Turn off the beep on abort for cases where the user aborted the capture (still beeps if something failed) Dialog proc changes for Gotcha Quiet dialog reorganization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mainwin.cpp

    r41 r51  
    159159    switch (msg)
    160160    {
     161#ifndef _QUIET_
    161162    case WM_CREATE:
     163#else
     164    case WM_INITDLG:
     165#endif
    162166        {
    163167#ifdef _DOLOGDEBUG_
    164168            LogDebug( "MainWin:WindowProcedure: WM_CREATE" );
    165169#endif
     170#ifndef _QUIET_
    166171            USHORT   usResID = WinQueryWindowUShort (hwnd, QWS_ID);
    167172
     
    177182                             rcl.yTop - rcl.yBottom,
    178183                             SWP_SHOW | SWP_MOVE | SWP_SIZE | SWP_ZORDER);
    179         }
     184#endif
     185        }
     186#ifdef _QUIET_
     187        WinSendDlgItemMsg (hwnd, WID_CB_HIDEWINDOW, BM_SETCHECK,
     188                           MPFROMLONG (TRUE), MPFROMLONG (0));
     189        WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
     190                           MPFROMLONG (pset->DelayedCapture ()),
     191                           MPFROMLONG (0));
     192        WinSetFocus( WinWindowFromID (g_hwndPage0, WID_RB_FILE), FALSE );
     193        return MRESULT (FALSE);
     194#else
    180195        break;
     196#endif
    181197
    182198    case WM_QUIT:
     
    210226                                         BM_QUERYCHECK, 0, 0));
    211227            pset->HideWindow (f);
    212 
     228#ifndef _QUIET_
    213229            f = BOOL (WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE,
    214230                                         BM_QUERYCHECK, 0, 0));
    215231            pset->DelayedCapture (f);
     232#endif
    216233        }
    217234        return MRESULT (FALSE);
     
    221238        return MRESULT (FALSE);
    222239
     240#ifndef _QUIET_
    223241    case WM_PAINT:
    224242        {
     
    237255        }
    238256        break;
     257#endif
    239258
    240259    case WM_COMMAND:
     
    244263        if (usState != STATE_IDLE)
    245264        {
     265            //Attempt to open settings probably a hang
     266            if (SHORT1FROMMP (mp1) == WID_PB_SETTINGS) {
     267                WinSendMsg (hwnd, UM_ABORT, 0,0);
     268                pset->Dialog ();
     269            }
    246270            // this means ESC was pressed
    247             if (SHORT1FROMMP (mp1) == DID_CANCEL)
    248                 WinSendMsg (hwnd, UM_ABORT, 0,0);
     271            else if (SHORT1FROMMP (mp1) == DID_CANCEL)
     272                WinSendMsg (hwnd, UM_ABORT, MPFROMLONG(1),0);
    249273            return MRESULT (FALSE);
    250274        }
     
    344368
    345369        case WID_PB_EXIT:
    346             WinSendMsg (hwnd, WM_CLOSE, 0,0);
     370            WinSendMsg (WinWindowFromID (hwndFrame, FID_CLIENT),
     371                        WM_CLOSE, 0,0);
    347372            break;
    348373
     
    371396#endif
    372397        }
    373         else {
     398        /*else {
    374399            SWP     swp;
    375400            CHAR    ach[32] = {0};
     
    386411                return MRESULT (FALSE);
    387412            }
    388         }
     413        } */
    389414#ifndef _QUIET_
    390415        if (WinQueryButtonCheckstate (hwnd, WID_CB_HIDEWINDOW)) {
     
    419444
    420445        case CAP_SCREENREGION:
     446#ifdef _QUIET_
     447            WinSetFocus(HWND_DESKTOP, hwnd);
     448#endif
    421449            if (DoTracking (&rcl))
    422450            {
     
    429457                                MPFROMHWND (HWND_DESKTOP));
    430458                if (rc == 2)
    431                     WinSendMsg (hwnd, UM_ABORT, 0,0);
     459                    WinSendMsg (hwnd, UM_ABORT, MPFROMLONG(1),0);
    432460                if (rc == 3) {
    433461                    pset->Dialog ();
     
    443471        case CAP_WINDOWINT:
    444472            fInterior = TRUE;
     473#ifdef _QUIET_
     474            WinSetFocus(HWND_DESKTOP, hwnd);
     475#endif
    445476            StartSelection (hwnd);
    446477            break;
     
    448479        case CAP_WINDOW:
    449480            fInterior = FALSE;
     481#ifdef _QUIET_
     482            WinSetFocus(HWND_DESKTOP, hwnd);
     483#endif
    450484            StartSelection (hwnd);
    451485            break;
     
    525559    case WM_TIMER:
    526560        ulCountdown --;
    527 
    528         if( ulCountdown % 20 == 0 ) {
    529             WinSendMsg (hwndSnapshot, UM_COUNTDOWN, MPFROMLONG (ulCountdown), 0);
    530 
    531             if (pset->DelayCountdown () && !pset->SerialCapture ())
    532                 DoCountdown (ulCountdown);
    533         }
     561       
     562        if( ulCountdown % 20 == 0 )
     563            WinSendMsg (hwndSnapshot, UM_COUNTDOWN,
     564                        MPFROMLONG (ulCountdown), 0);
     565        if (pset->DelayCountdown () && !pset->SerialCapture ())
     566            DoCountdown (ulCountdown);
    534567
    535568        if (ulCountdown == 0)
     
    593626
    594627    case UM_ABORT:
    595         DosBeep (75, 200);
     628        if (LONGFROMMP(mp1) != 1)
     629            DosBeep (75, 200);
    596630        WinSendMsg (hwnd, UM_CLEANUP, 0,0);
    597631        return MRESULT (FALSE);
     
    631665    LogDebug( "MainWin:WindowProcedure:WinDefWindowProc->0x%04x", msg );
    632666#endif
    633     return WinDefWindowProc (hwnd, msg, mp1, mp2);
     667    if (hwnd ==  g_hwndPage0)
     668        return WinDefDlgProc (hwnd, msg, mp1, mp2);
     669    else
     670        return WinDefWindowProc (hwnd, msg, mp1, mp2);
    634671}
    635672
Note: See TracChangeset for help on using the changeset viewer.