Beispiel #1
0
static Boolean MainFormControlSelected(AppContext* appContext, FormType* form, EventType* event)
{
    Boolean handled = false;

    switch (event->data.ctlSelect.controlID)
    {
        case buttonFind:
            MainFormFindButtonPressed(appContext, form);
            handled = true;
            break;
            
        case buttonAbortLookup:
            if (ConnectionInProgress(appContext))
                AbortCurrentConnection(appContext, true);
            handled = true;
            break;

        case backButton:
            DoBack(appContext);
            handled = true;
            break;

        case forwardButton:
            DoForward(appContext);
            handled = true;
            break;

        default:
            Assert(false);
    }
    return handled;
}
Beispiel #2
0
static Boolean MainFormMenuCommand(AppContext* appContext, FormType* form, EventType* event)
{
    Boolean handled=false;
    switch (event->data.menu.itemID)
    {
        case menuItemAbout: 
            MainFormHandleAbout(appContext);
            handled=true;
            break;

        case menuItemCopy:
            MainFormHandleCopy(appContext);
            handled=true;
            break;

        case menuItemLookupClipboard:
            MainFormLookupClipboard(appContext);
            handled=true;
            break;

        case menuItemRandomWord:
            LookupRandomWord(appContext);
            handled=true;
            break;

        case menuItemRecentLookups:
            MainFormHandleRecentLookups(appContext);
            handled=true;
            break;

        case menuItemPrefs:
            FrmPopupForm(formPrefs);
            handled=true;
            break;

        case menuItemDispPrefs:
            FrmPopupForm(formDisplayPrefs);
            handled=true;
            break;

        case menuItemRegister:
#ifdef UNLOCKED
            FrmAlert(alreadyRegisteredAlert);
#else
            MainFormHandleRegister(appContext,false);
#endif
            FrmUpdateForm(formDictMain, redrawAll); 
            handled=true;
            break;

        case menuItemBookmarkView:
            if (GetBookmarksCount(appContext)>0)
                FrmPopupForm(formBookmarks);
            else
                FrmAlert(alertNoBookmarks);
            handled=true;
            break;

        case menuItemBookmarkWord:
            if (ebufGetDataSize(&appContext->currentWordBuf))
                AddBookmark(appContext, ebufGetDataPointer(&appContext->currentWordBuf));
            handled=true;
            break;

        case menuItemBookmarkDelete:
            if (ebufGetDataSize(&appContext->currentWordBuf))
                DeleteBookmark(appContext, ebufGetDataPointer(&appContext->currentWordBuf));
            handled=true;
            break;

        case menuItemGotoWebsite:
            //if ( errNone != ErrWebBrowserCommand(false, 0, sysAppLaunchCmdGoToURL, "http://arslexis.local.org:4080/pda/palm.html",NULL) )
            if ( errNone != ErrWebBrowserCommand(false, 0, sysAppLaunchCmdGoToURL, "http://www.arslexis.com/pda/palm.html",NULL) )
                FrmAlert(alertNoWebBrowser);
            handled=true;
            break;

        case menuItemCheckUpdates:
            //if ( errNone != ErrWebBrowserCommand(false, 0, sysAppLaunchCmdGoToURL, "http://arslexis.local.org:4080/updates/palm-inoah-1-0.html",NULL) )
            if ( errNone != ErrWebBrowserCommand(false, 0, sysAppLaunchCmdGoToURL, "http://www.arslexis.com/updates/palm-inoah-1-1.html",NULL) )
                FrmAlert(alertNoWebBrowser);
            handled=true;
            break;
        case forwardMenuItem:
            DoForward(appContext);
            handled=true;
            break;
        case backMenuItem:
            DoBack(appContext);
            handled=true;
            break;
#ifdef DEBUG
        case menuItemStress:
            appContext->fInStress = true;
            LookupRandomWord(appContext);
            handled=true;
            break;
#endif

        case sysEditMenuCopyCmd:
        case sysEditMenuCutCmd:
        case sysEditMenuPasteCmd:
            // generated by command bar, not sure what to do with those
            // so just ignore them
            handled = false;
            break;
        default:
            Assert(false);
    }
    return handled;
}
Beispiel #3
0
/*  readSKey - handle additional keys for the read file window.
 *
 *  arguments:
 *      hWnd        handle of window receiving message
 *      key         keystroke to handle
 *
 *  return value:
 *      TRUE (-1)   key handled, exit window proc immediately
 *      FALSE (0)   key not handled
 *
 *  IMPORTANT:
 *      this procedure should be used as the keyProc for read windows with
 *      messages ONLY!
 */
FLAG PASCAL INTERNAL readSKey ( HW hWnd, INT key )
{
    FLAG retVal = TRUE;
    struct fileType *pFT;
    HW      hWndT;
    PSTR    pTmpFN;
    CHAR    buf [ MAXLINELEN ];
    INT     ch;
    PSTR    p;
    INT     idoc;
    INT     inote;

    /*
     *  if key == c | m | w then we are going to start a command and pass
     *  subsequent chars to CommandChar.
     *  These chars appear on the command line.
     *  cchCmdLine is the number of chars on the command line.
     *  ENTER and ^C when sent to CommandChar will set cchCmdLine to zero.
     *  When there are char on cmd line, we pass the buck to CommandChar.
     *  When there are no char on cmd line, then we do all processing here.
     *
     *  Don't use BringToTop (hCommand ) because we want this window to
     *  remain the topmost window so it receives all char so we can monitor
     *  when cchCmdLine goes to zero.
     */

    if ( cchCmdLine ) {
        CommandChar ( hCommand, key );  /* will change value of cchCmdLine */
        hWndT = ( cchCmdLine ? hCommand : hWnd );
        SetCursor ( hWndT, hWndT->crsrX, hWndT->crsrY );
        return TRUE;
        }

    if ( (key > 127) || (key < 0) ) key = 0;	/* if extended code, null and drop through*/

    switch ( ( ch = tolower ( key ) ) ) {
    case 'c':
        p = "copy . ";
        goto strtcmd;
    case 'm':
        p = "move . ";
        goto strtcmd;
    case 'w':
        p = "write ";
strtcmd:
        if ( fAllowCM ) {
            while ( *p )
                CommandChar ( hCommand, *p++ );
            SetCursor ( hCommand, hCommand->crsrX, hCommand->crsrY );
        }
        else
            retVal = FALSE;
        break;
    case 'd':
        ChangeHeaderFlag ( idocRead, F_DELETED, 0 );
    case 'e' :
    case 'n' :
    case 'p' :
    case ENTER :
    case CTRLENTER :
        switch ( ch ) {
        case 'e' :
            sprintf ( buf, "%d", idocRead + 1 );
            DoEditMsg ( hCommand, buf, 0 );
            idoc = idocRead;
            break;
        case 'd' :
        case 'n' :
        case ENTER :
        case 'p' :
            idoc = -1;
            inote = Look4Inote (MapIdocInote (idocRead),
                                ch == 'p' ? -1 : 1,
                                !(key == 'N' || key == 'P'));
            if ( inote != ERROR )
                idoc = mpInoteIdoc [ inote ];
            break;
        case CTRLENTER :
            idoc = NextUnread ( MapIdocInote ( idocRead ) );
            break;
        default :
            idoc = -1;
            break;
            }
        pTmpFN = mktmpnam ( );
        if ( ( idoc != -1 ) && ( IdocToFile ( idoc, pTmpFN, 0 ) != ERROR)) {
            ChangeHeaderFlag ( idocRead = idoc, 0, F_UNREAD );
            SendMessage ( hWnd, CLOSE, 0 );
            hReadMessage = hWnd;    /* CLOSE set it to null */
            pFT = ( struct fileType *) ZMalloc ( sizeof ( *pFT ) );
            pFT->fDeleteRead = TRUE;
            pFT->fileRead = ZMMakeStr ( pTmpFN );
            /* redraw window w/o erasing and redrawing everything else */
            SendMessage ( hWnd, CREATE, pFT );
            sprintf ( buf, "Message %d", idoc + 1 );
            SetWindowText ( hWnd, buf );
            if ( ch == 'e' )
                BringToTop ( hWnd, TRUE );
            else
                DrawWindow ( hWnd, FALSE );
            SendMessage ( hHeaders, GOTOIDOCALL, idocRead = idoc );
            }
        else
            SendMessage ( hWnd, KEY, ESC );
        ZMfree ( pTmpFN );
        break;
    case 'f' :
    case 'r' :
        CloseWindow ( hWnd );
        commandLine[0] = (CHAR) key;
        commandLine[1] = '\0';
        if ( ch == 'f' )
            DoForward ( hCommand, strEMPTY, 0 );
        else
            DoReply ( hCommand, strEMPTY, 0 );
        SendMessage ( hCommand, DISPPROMPT, TRUE );
        break;
    default :
        retVal = FALSE;
        break;
        }
    return retVal;
}