Changeset 51 for trunk


Ignore:
Timestamp:
Apr 7, 2018, 10:04:50 PM (8 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.

Location:
trunk
Files:
2 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
  • trunk/settings.cpp

    r41 r51  
    219219        }
    220220#ifndef _QUIET_
    221 //#if 0
    222221        // open and assign dialogs to pages
    223222        hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page1Procedure,
     
    263262    WinSendDlgItemMsg (g_hwndPage0, WID_RB_FILE, BM_CLICK,
    264263                       MPFROMSHORT (TRUE), 0);
    265     WinSendDlgItemMsg (g_hwndPage0, WID_CB_HIDEWINDOW, BM_SETCHECK,
    266                        MPFROMLONG (TRUE), MPFROMLONG (0));
     264    //WinSendDlgItemMsg (g_hwndPage0, WID_CB_HIDEWINDOW, BM_SETCHECK,
     265    //                   MPFROMLONG (TRUE), MPFROMLONG (0));
    267266    //WinSetFocus (WinWindowFromID (hwndDlg, WID_PB_OK), TRUE);
    268     //WinSetFocus( hwndPage[0], TRUE );
     267    //WinSetFocus( hwndPage[0], FALSE );
    269268#ifdef _QUIET_
    270269    if (HACCEL haccel = WinLoadAccelTable (hab, GETMODULE, 1)) {
    271270        int rc = WinSetAccelTable (hab, haccel, hwndDlg);
    272         _PmpfF(( " Acceltable %i", rc));
    273     }
    274 #endif
    275     WinSetActiveWindow( HWND_DESKTOP, hwndPage[0] );
     271    }
     272#endif
     273    WinSetActiveWindow( HWND_DESKTOP, hwndDlg );
    276274#ifdef _DOLOGDEBUG_
    277275    LogDebug( "Dialog: checkpoint 7" );
     
    355353            break;
    356354
     355        case WID_PB_ABOUT:
     356            AboutBox (hwnd);
     357            break;
     358
    357359        case DID_CANCEL:
    358360            {
     
    636638
    637639    case WM_COMMAND:
     640
     641        if( SHORT1FROMMP( mp1 ) == WID_PB_OK) {
     642            saveum = TRUE;
     643            WinSendMsg ( g_hwndSettingsDialog, WM_CLOSE, 0,0);
     644        }
    638645        if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
    639646            WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
     
    657664        pset->AdjustButton (hwnd, WID_CB_DELAYCOUNTDOWN,
    658665                            pset->DelayCountdown ());
     666        pset->AdjustButton (hwnd, WID_CB_DELAYEDCAPTURE,
     667                            pset->DelayedCapture ());
    659668
    660669        // init delay time sb
     
    728737            pset->DelayCountdown(WinQueryButtonCheckstate
    729738                                 (hwnd, WID_CB_DELAYCOUNTDOWN));
     739            pset->DelayedCapture (WinQueryButtonCheckstate
     740                                  (hwnd,WID_CB_DELAYEDCAPTURE));
    730741#endif
    731742        // get ssw capture type
     
    781792                WinShowWindow (hwndSnapshot, TRUE);
    782793            break;
     794        case WID_CB_DELAYEDCAPTURE:
     795
     796            WinSendDlgItemMsg (g_hwndPage0, WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
     797                               MPFROMLONG (WinQueryButtonCheckstate
     798                                           (hwnd,WID_CB_DELAYEDCAPTURE)),
     799                               MPFROMLONG (0));
     800            WinSendDlgItemMsg (WinWindowFromID(hwndFrame, FID_CLIENT),
     801                               WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
     802                               MPFROMLONG (WinQueryButtonCheckstate
     803                                           (hwnd,WID_CB_DELAYEDCAPTURE)),
     804                               MPFROMLONG (0));
     805            break;
    783806        }
    784807        return MRESULT (FALSE);
Note: See TracChangeset for help on using the changeset viewer.