예제 #1
0
파일: exams.c 프로젝트: timn/unimatrix
Boolean
ExamDetailsFormHandleEvent(EventPtr event)
{
  FormPtr frm=FrmGetActiveForm();
  Boolean handled = false;

  if (event->eType == ctlSelectEvent) {
    // button handling
    switch (event->data.ctlSelect.controlID) {
      case BUTTON_exd_cancel:
        handled=true;
        ExamDetailsFormFree();
        FrmReturnToForm(FORM_exams);
        FrmUpdateForm(FORM_exams, frmRedrawUpdateCode);
        break;

      case BUTTON_exd_ok:
        handled=true;
        if (ExamDetailsFormSave()) {
          ExamDetailsFormFree();
          FrmReturnToForm(FORM_exams);
          FrmUpdateForm(FORM_exams, frmRedrawUpdateCode);
        }
        break;

      case SELECTOR_exd_date:
        handled=true;
        ExamDetailsGetDate();
        break;

      case SELECTOR_exd_time:
        handled=true;
        EditTimeGetTime(GetObjectPtr(SELECTOR_exd_time), &gExamDetailsBegin, &gExamDetailsEnd, gExamDetailsTimeTrigger);
        break;

      default:
        break;
    }
  } else if (event->eType == menuOpenEvent) {
    return HandleMenuOpenEvent(event);
  } else if (event->eType == menuEvent) {
    // forwarding of menu events
    return HandleMenuEvent(event->data.menu.itemID);
  } else if (event->eType == frmOpenEvent) {
    // initializes and draws the form
    ExamDetailsFormInit(frm);
    FrmDrawForm (frm);
    handled = true;
  } else if (event->eType == frmUpdateEvent) {
    // redraws the form if needed
    FrmDrawForm (frm);
    handled = false;
  } else if (event->eType == frmCloseEvent) {
    // this is done if form is closed
    ExamDetailsFormFree();
  }

  return (handled);
}
예제 #2
0
파일: main_form.c 프로젝트: kjk/noah-palm
static Boolean MainFormDisplayChanged(AppContext* appContext, FormType* form) 
{
    Assert( DIA_Supported(&appContext->diaSettings) );
    if ( !DIA_Supported(&appContext->diaSettings) )
        return false;

    //return true;
    UpdateFrmBounds(form);

    FrmSetObjectPosByID(form, backButton,    -1, appContext->screenHeight-14);
    FrmSetObjectPosByID(form, forwardButton, -1, appContext->screenHeight-14);
    FrmSetObjectPosByID(form, labelWord, -1, appContext->screenHeight-14);
    FrmSetObjectBoundsByID(form, fieldWordInput, -1, appContext->screenHeight-14, appContext->screenWidth-80, -1);
    FrmSetObjectPosByID(form, buttonFind, appContext->screenWidth-26, appContext->screenHeight-14);

    FrmSetObjectPosByID(form, buttonAbortLookup, appContext->screenWidth-14, appContext->screenHeight-14);

    FrmSetObjectBoundsByID(form, scrollDef, appContext->screenWidth-8, -1, -1, appContext->screenHeight-18);

    // TODO: optimize, only do when dx screen size has changed   
    SendEvtWithType(evtReformatLastResponse);
    FrmUpdateForm(formDictMain, frmRedrawUpdateCode);        

    return true;
}
예제 #3
0
파일: exams.c 프로젝트: timn/unimatrix
static void
ExamDelete(void)
{
  MemHandle mex, m;
  ExamDBRecord *ex;
  UInt16 index=0, pressedButton=0;
  Char *courseName, timeTemp[timeStringLength], dateTemp[longDateStrLength];

  DmFindRecordByID(DatabaseGetRefN(DB_MAIN), gExamsLastSelRowUID, &index);
  mex = DmQueryRecord(DatabaseGetRefN(DB_MAIN), index);
  ex = (ExamDBRecord *)MemHandleLock(mex);

  m=MemHandleNew(1);
  CourseGetName(ex->course, &m, true);
  courseName = MemHandleLock(m);

  DateToAscii(ex->date.month, ex->date.day, ex->date.year+MAC_SHIT_YEAR_CONSTANT, PrefGetPreference(prefLongDateFormat), dateTemp);
  TimeToAscii(ex->begin.hours, ex->begin.minutes, PrefGetPreference(prefTimeFormat), timeTemp);

  pressedButton = FrmCustomAlert(ALERT_ex_dodel, courseName, dateTemp, timeTemp);

  MemHandleUnlock(m);
  MemHandleFree(m);
  MemHandleUnlock(mex);

  if (pressedButton == 0) {
    // OK, the user really wants us to delete the record
    NoteDelete(&index);
    DmRemoveRecord(DatabaseGetRefN(DB_MAIN), index);
    gExamsSelRow=0;
    FrmUpdateForm(FORM_exams, frmRedrawUpdateCode);
  }
}
예제 #4
0
파일: main_form.c 프로젝트: kjk/noah-palm
static void MainFormFindButtonPressed(AppContext* appContext, FormType* form)
{
    const char* newWord=NULL;
    UInt16      index=FrmGetObjectIndex(form, fieldWordInput);

    Assert(frmInvalidObjectId!=index);

    FieldType* field=static_cast<FieldType*>(FrmGetObjectPtr(form, index));
    const char* prevWord=ebufGetDataPointer(&appContext->currentWordBuf);
    Assert(field);
    newWord=FldGetTextPtr(field);
    if (newWord && (StrLen(newWord)>0) && (!prevWord || 0!=StrCompare(newWord, prevWord)))
        StartWordLookup(appContext, newWord);
    else if (mainFormShowsDefinition!=appContext->mainFormContent)
    {
        const char* currentDefinition=ebufGetDataPointer(&appContext->currentDefinition);
        if ( NULL != currentDefinition )
        {
            // it can be NULL if we didn't have a definition and pressed "GO"
            // with no word in text field
            cbNoSelection(appContext);
            appContext->mainFormContent=mainFormShowsDefinition;

            diSetRawTxt(appContext->currDispInfo, const_cast<char*>(currentDefinition));
            FrmUpdateForm(formDictMain, redrawAll);
        }
    } 
}
예제 #5
0
파일: main_form.c 프로젝트: kjk/noah-palm
static Boolean MainFormScrollExit(AppContext* appContext, FormType* form, EventType* event)
{
    Int16 newValue = event->data.sclRepeat.newValue;
    if (newValue != appContext->firstDispLine)
    {
        appContext->firstDispLine = newValue;
        FrmUpdateForm(formDictMain, frmRedrawUpdateCode);
    }
    return false;
}
예제 #6
0
static void
EventLoop (void)
{
    EventType	event;
    SDWord	timeout;
    UInt32	timer_next;
    Word	error;

    do
    {
        timeout = evtWaitForever;
        timer_next = 0;
        if (needRedisplay)
            timeout = 0;
        else if (game.timer_running)
        {
            UInt32  now = TimGetTicks ();
            int	    sec = (now - game.timer_start) / sysTicksPerSecond;

            timer_next = ((sec + 1) * sysTicksPerSecond + game.timer_start);
            timeout = timer_next - now;
        }
        EvtGetEvent (&event, timeout);
        DIAG (("Event %d\n", event.eType));
        if (timer_next && TimGetTicks () <= timer_next)
            DamageCount ();
        if (needRedisplay && event.eType == nilEvent)
            FrmUpdateForm (mainForm, frmRedrawUpdateCode);
        if (event.eType == nilEvent)
            continue;

        /* Give the system a chance to handle the event. */
        if (! SysHandleEvent (&event))
        {
            if (!MenuHandleEvent (0, &event, &error))
            {
                /* Give the application a chance to handle the event. */
                if (!ApplicationHandleEvent (&event))
                {
                    /* Let the form object provide default handling of the event. */
                    FrmDispatchEvent (&event);
                }
            }
        }
    }
    while (event.eType != appStopEvent);
    // ** SPECIAL NOTE **
    // In order for the Emulator to exit
    // cleanly when the File|Quit menu option is
    // selected, the running application
    // must exit.  The emulator will generate an
    // ÒappStopEventÓ when Quit is selected.
}
예제 #7
0
파일: main_form.c 프로젝트: kjk/noah-palm
static void MainFormHandleConnectionProgress(AppContext* appContext, FormType* form, EventType* event)
{
    Assert(event);
    ConnectionProgressEventData* data=reinterpret_cast<ConnectionProgressEventData*>(&event->data);
    if (connectionProgress==data->flag) 
        FrmUpdateForm(formDictMain, redrawLookupStatusBar);
    else
    {
        UInt16 index=FrmGetObjectIndex(form, buttonAbortLookup);
        Assert(frmInvalidObjectId!=index);
        
        if (connectionFinished==data->flag)
        {
            appContext->lookupStatusBarVisible=false;
            FrmHideObject(form, index);
            index=FrmGetObjectIndex(form, buttonFind);
            Assert(frmInvalidObjectId!=index);
            FrmShowObject(form, index);
            MainFormSelectWholeInputText(form);
        }
        else 
        {
            Assert(connectionStarted==data->flag);
            appContext->lookupStatusBarVisible=true;
            FrmShowObject(form, index);
            index=FrmGetObjectIndex(form, buttonFind);
            Assert(frmInvalidObjectId!=index);
            FrmHideObject(form, index);
        }
        FrmUpdateForm(formDictMain, redrawAll); 
    }        

    if (connectionFinished==data->flag)
    {
        SendEvtWithType(evtConnectionFinished);
    }
}
예제 #8
0
static Boolean WordsListFormOpen(AppContext* appContext, FormType* form, EventType* event)
{
    Assert(appContext->wordsList);
    Assert(appContext->wordsInListCount);
    UInt16 index=FrmGetObjectIndex(form, listProposals);
    Assert(frmInvalidObjectId!=index);
    ListType* list=static_cast<ListType*>(FrmGetObjectPtr(form, index));
    Assert(list);
    LstSetListChoices(list, appContext->wordsList, appContext->wordsInListCount);

    index=FrmGetObjectIndex(form, fieldWordInput);
    Assert(frmInvalidObjectId!=index);
    FrmSetFocus(form, index);
        
    FrmUpdateForm(formPrefs, frmRedrawUpdateCode);
    return true;
}
예제 #9
0
static Boolean WordListFormDisplayChanged(AppContext* appContext, FormType* form) 
{
    Assert( DIA_Supported(&appContext->diaSettings) );
    if ( !DIA_Supported(&appContext->diaSettings) )
        return false;

    UpdateFrmBounds(form);

    SetListHeight(form, listProposals, appContext->dispLinesCount);
    FrmSetObjectBoundsByID(form, listProposals, -1, -1, appContext->screenWidth, -1);

    FrmSetObjectPosByID(form, ctlArrowLeft, -1, appContext->screenHeight-12);
    FrmSetObjectPosByID(form, ctlArrowRight, -1, appContext->screenHeight-12);

    FrmSetObjectBoundsByID(form, fieldWordInput, -1, appContext->screenHeight-13, appContext->screenWidth-66, -1);
    FrmSetObjectPosByID(form, buttonCancel,  appContext->screenWidth-40, appContext->screenHeight-14);

    FrmUpdateForm(formWordsList, frmRedrawUpdateCode);        
    return true;
}
예제 #10
0
static Boolean ResidentBrowseFormWinEnter(AppContext* appContext, FormType* form, EventType* event)
{
    struct _WinEnterEventType* winEnter=(struct _WinEnterEventType*)&event->data;
    if (winEnter->enterWindow==(void*)form) // this means we're entering this window for the first time and we have to do initial list drawing
    {
        FieldType* field=NULL;
        ListType* list=NULL;
        UInt16 index=FrmGetObjectIndex(form, fieldWord);
        Assert(index!=frmInvalidObjectId);
        field=(FieldType*)FrmGetObjectPtr(form, index);
        index=FrmGetObjectIndex(form, listMatching);
        Assert(index!=frmInvalidObjectId);
        list=(ListType*)FrmGetObjectPtr(form, index);
        appContext->prevSelectedWord = 0xffffffff;
        LstSetListChoicesEx(list, NULL, dictGetWordsCount(GetCurrentFile(appContext)));
        LstSetDrawFunction(list, ListDrawFunc);
        appContext->prevTopItem = 0;
        Assert(appContext->selectedWord < appContext->wordsCount);
        if (*appContext->lastWord)
        {
            appContext->selectedWord = 0;
            FldInsert(field, appContext->lastWord, StrLen(appContext->lastWord));
            FldSendChangeNotification(field);
        }
        else
        {
            if (-1==appContext->currentWord)
                appContext->selectedWord=0;
            else
                appContext->selectedWord=appContext->currentWord;             
            LstSetSelectionEx(appContext, list, appContext->selectedWord);
        }            
        index=FrmGetObjectIndex(form, fieldWord);
        Assert(index!=frmInvalidObjectId);
        FrmSetFocus(form, index);
        FrmUpdateForm(formResidentBrowse, frmRedrawUpdateCode);
    }
    return false;
}
예제 #11
0
파일: main_form.c 프로젝트: kjk/noah-palm
static Boolean MainFormOpen(AppContext* appContext, FormType* form, EventType* event)
{

    FrmUpdateForm(formDictMain, redrawAll);

    UInt16 index=FrmGetObjectIndex(form, fieldWordInput);
    FrmSetFocus(form, index);

    UpdateHistoryButtons(appContext);

    switch (appContext->prefs.startupAction)
    {
        case startupActionClipboard:
            MainFormLookupClipboard(appContext);
            break;

        case startupActionLast:
            if (StrLen(appContext->prefs.lastWord))
                StartWordLookup(appContext, appContext->prefs.lastWord);
            break;
    }
    
    return true;
}
예제 #12
0
파일: xfer.c 프로젝트: jemyzhang/DiddleBug
/*
** Initiates transfer mode.
*/
void StartXferMode(void) {
  FormType* frm = FrmGetActiveForm();
  FieldType* fld =  GetObjectPointer(frm, XferField);
  const UInt32 len = MemHandleSize(d.record_name);
  MemHandle textH = MemHandleNew(len);

  ASSERT(textH);

  FlushToBuffer();
  FrmSetMenu(frm, XferMenu);
  d.is_xfer_mode = true;
  ToggleButtonBar(frm, false);
  ResetDrawingAreaRectangle(p.formID == DiddleTForm, true);
  FrmUpdateForm(p.formID, 0);
  InitXferList();
  ToggleXferBar(frm, true);
  FrmSetFocus(frm, FrmGetObjectIndex(frm, XferField));

  /* Init field with record title */
  MemMove(MemHandleLock(textH), MemHandleLock(d.record_name), len);
  MemHandleUnlock(textH);
  MemHandleUnlock(d.record_name);
  FldSetTextHandle(fld, textH);
}
예제 #13
0
파일: URLForm.c 프로젝트: openmobl/Atlas
static Boolean URLFormDoCommand(UInt16 command)
{
    GlobalsPtr  gP = GetGlobals();
    Boolean     handled = false;

    if (!gP)
        return false;

    switch (command) {
        // Menus
        // Control Objects
        case kURLOpenButton:
            {
                Char    *navigationText = FldGetTextPtr(GetObjectPtr(kURLField));
                Boolean openInNewTab = false;
                
                if (navigationText && StrLen(navigationText)) {
                    if (gP->navigationOpen) {
                        MemPtrFree(gP->navigationOpen);
                    }
                    gP->navigationOpen = StrDup(navigationText);
                    
                    if (CtlGetValue(GetObjectPtr(kURLOpenInNewTabCheckbox))) {
                        openInNewTab = true;
                    }
                    
                    FrmReturnToForm(0);
                    if (openInNewTab) {
                        FrmUpdateForm(kMainForm, frmUpdateNewTab);
                    }
                    FrmUpdateForm(kMainForm, URLFormDetermineRequestType(navigationText));
                }
            }
            break;
        case kURLCancelButton:
            FrmReturnToForm(0);
            break;
        // Handle inserting text using the insert buttons, or list.
        case kWWWPushButton:
        case kCOMPushButton:
        case kORGPushButton:
        case kNETPushButton:
        case kSlashPushButton:
        case kDotPushButton:
        case kHTMLPushButton:
            {
                FieldPtr    urlFldP         = GetObjectPtr(kURLField);
                const Char  *buttonLabelP   = CtlGetLabel(GetObjectPtr(command));
                
                FldInsert(urlFldP, buttonLabelP, StrLen(buttonLabelP));
                CtlSetValue(GetObjectPtr(command), 0);
                
                handled = true;
            }
            break;
        case kMoreTrigger:
            {
                ListPtr     moreListP   = GetObjectPtr(kMoreList);
                FieldPtr    urlFldP     = GetObjectPtr(kURLField);
                Int16       selection   = LstPopupList(moreListP);
                
                if (selection >= 0) {
                    const Char  *selectionP = LstGetSelectionText(moreListP, selection);
                
                    FldInsert(urlFldP, selectionP, StrLen(selectionP));
                }
                handled = true;
            }
            break;
        // Default
        default:
            break;
    }

    return handled;
}
예제 #14
0
/* Event handler for the details form */
Boolean DetailsFormHandleEvent
    (
    EventType* event  /* pointer to an EventType structure */
    )
{
    Boolean handled;
    Boolean update;

    handled     = false;
    update      = false;

    switch ( event->eType ) {
        case ctlSelectEvent:
            if ( event->data.ctlEnter.controlID == frmDetailsOK ) {
                UInt16  reference;
                Boolean oldStatus;
                Boolean newStatus;

                reference = GetHistoryCurrent();
                oldStatus = ShowImages( reference );
                newStatus = CtlGetValue( GetObjectPtr( frmDetailsShowImages ) );
                update    = oldStatus ^ newStatus;

                if ( newStatus )
                    ShowImagesOn( reference );
                else
                    ShowImagesOff( reference );

                if ( CtlGetValue( GetObjectPtr( frmDetailsStatusRead ) ) )
                    SetVisitedLink( reference );
                else
                    UnsetVisitedLink( reference );

            }
            else if ( event->data.ctlEnter.controlID == frmDetailsCopy ) {
                FieldType* field;

                field = GetObjectPtr( frmDetailsLink );
                WriteTextFieldToMemo( field );
            }
            else if ( event->data.ctlEnter.controlID != frmDetailsCancel ) {
                break;
            }
            FrmReturnToForm( PREVIOUS_FORM );
            if ( update ) {
                ResetHeight();
                FrmUpdateForm( GetMainFormId(), frmRedrawUpdateCode );
            }
            handled = true;
            break;

        case winEnterEvent:
            handled = ResizeHandleWinEnterEvent();
            break;

        case winDisplayChangedEvent:
            handled = ResizeHandleWinDisplayChangedEvent();
            break;

        case winExitEvent:
            handled = ResizeHandleWinExitEvent();
            break;

        case frmOpenEvent:
#ifdef HAVE_SILKSCREEN
            ResizeHandleFrmOpenEvent();
#endif
            DetailsFormInit();
            handled = true;
            break;

        case frmCloseEvent:
#ifdef HAVE_SILKSCREEN
            ResizeHandleFrmCloseEvent();
#endif
            handled = false;
            break;

        default:
            handled = false;
    }

    return handled;
}
예제 #15
0
파일: exams.c 프로젝트: timn/unimatrix
Boolean
ExamsFormHandleEvent(EventPtr event)
{
  FormPtr frm=FrmGetActiveForm();
  Boolean handled = false;
  Boolean categoryEdited, reDraw=false;
  UInt16 category, numRecords;
  ControlType *ctl;
  UInt32 *recordList;

  if (event->eType == ctlSelectEvent) {
    // button handling
    switch (event->data.ctlSelect.controlID) {
      case BUTTON_ex_back:
        handled=true;
        FrmGotoForm(FORM_main);
        break;

      case BUTTON_ex_add:
        handled=true;
        if (CountCourses() > 0) {
          gExamsLastSelRowUID=0;
          FrmPopupForm(FORM_exam_details);
        } else {
          FrmAlert(ALERT_nocourses);
        }
        break;

      case BUTTON_ex_edit:
        handled=true;
        gExamsLastSelRowUID=TblGetRowData(GetObjectPtr(TABLE_exams), gExamsSelRow);
        FrmPopupForm(FORM_exam_details);
        break;

      case BUTTON_ex_note:
      {
        UInt16 index=0;

        handled=true;

        gExamsLastSelRowUID=TblGetRowData(GetObjectPtr(TABLE_exams), gExamsSelRow);
        DmFindRecordByID(DatabaseGetRefN(DB_MAIN), gExamsLastSelRowUID, &index);
        NoteSet(index, FORM_exams);
        FrmPopupForm(NewNoteView);
        break;
      }

      case BUTTON_ex_del:
        handled=true;
        gExamsLastSelRowUID=TblGetRowData(GetObjectPtr(TABLE_exams), gExamsSelRow);
        ExamDelete();
        break;

      case BUTTON_ex_beam:
        handled=true;
        gExamsLastSelRowUID=TblGetRowData(GetObjectPtr(TABLE_exams), gExamsSelRow);
        ExamBeam();
        break;

      case LIST_ex_cat_trigger:
        handled=true;
        category=DatabaseGetCat();
        numRecords=DmNumRecordsInCategory(DatabaseGetRef(), DELETE_CATEGORY);
        recordList=(UInt32 *)MemPtrNew(numRecords * sizeof(UInt32));
        CatPreEdit(numRecords, recordList);
        categoryEdited = CategorySelect(DatabaseGetRef(), frm,
                                        LIST_ex_cat_trigger, LIST_ex_cat, false,
                                        &category, gCategoryName, 0,
                                        STRING_cat_edit); // categoryDefaultEditCategoryString
        if (categoryEdited || (category != DatabaseGetCat())) {
          reDraw=true;
          DatabaseSetCat(category);
          ctl = GetObjectPtr(LIST_ex_cat_trigger);
          CategoryGetName(DatabaseGetRef(), category, gCategoryName); 
          CategorySetTriggerLabel(ctl, gCategoryName);
        }
        CatPostEdit(numRecords, recordList);
        if (reDraw) {
          gExamsOffset=0;
          gExamsSelRow=0;
          FrmUpdateForm(FORM_exams, frmRedrawUpdateCode);
        }
        if (recordList != NULL)  MemPtrFree((MemPtr)recordList);
        break;

      default:
        break;
    }
  } else if (event->eType == tblEnterEvent) {
    UInt16 i;
    
    if (event->data.tblEnter.column == EXCOL_DONE) {
      handled=false;
    } else if (event->data.tblEnter.column == EXCOL_NOTE) {
      MemHandle m;
      Boolean hasNote=false;

      gExamsSelRow=event->data.tblEnter.row;
      for (i=0; i < TblGetNumberOfRows(event->data.tblEnter.pTable); ++i) {
        RectangleType r;
        TblGetItemBounds(event->data.tblEnter.pTable, i, EXCOL_SELI, &r);
        TableDrawSelection(event->data.tblEnter.pTable, i, event->data.tblEnter.column, &r);
      }


      m = DmQueryRecord(DatabaseGetRefN(DB_MAIN), TblGetRowID(event->data.tblEnter.pTable, event->data.tblEnter.row));
      if (m) {
        ExamDBRecord *ex = (ExamDBRecord *)MemHandleLock(m);
        if (ex->note) hasNote = true;
        else          hasNote = false;
        MemHandleUnlock(m);
      }

      if (hasNote) {
        Coord newPointX, newPointY;
        Boolean isPenDown=false, drawn=false;
        RectangleType fieldBounds;
        IndexedColorType curForeColor, curBackColor, curTextColor;
        Char noteSymb[2] = { GADGET_NOTESYMBOL, 0 };
        FontID oldFont;
  
  
        EvtGetPen(&newPointX, &newPointY, &isPenDown);
        TblGetItemBounds(event->data.tblEnter.pTable, event->data.tblEnter.row, EXCOL_NOTE, &fieldBounds);
  
        oldFont = FntSetFont(symbolFont);
        while (isPenDown){
          if (! drawn && RctPtInRectangle(newPointX, newPointY, &fieldBounds)) {
            curForeColor = WinSetForeColor(UIColorGetTableEntryIndex(UIObjectSelectedForeground));
            curBackColor = WinSetBackColor(UIColorGetTableEntryIndex(UIObjectSelectedFill));
            curTextColor = WinSetTextColor(UIColorGetTableEntryIndex(UIObjectSelectedForeground));
            TNDrawCharsToFitWidth(noteSymb, &fieldBounds);
            WinSetForeColor(curForeColor);
            WinSetForeColor(curBackColor);
            WinSetForeColor(curTextColor);
            drawn = true;
          } else if (drawn && ! RctPtInRectangle(newPointX, newPointY, &fieldBounds)) {
            curForeColor = WinSetForeColor(UIColorGetTableEntryIndex(UIObjectForeground));
            curBackColor = WinSetBackColor(UIColorGetTableEntryIndex(UIObjectFill));
            curTextColor = WinSetTextColor(UIColorGetTableEntryIndex(UIObjectForeground));
            TNDrawCharsToFitWidth(noteSymb, &fieldBounds);
            WinSetForeColor(curForeColor);
            WinSetForeColor(curBackColor);
            WinSetForeColor(curTextColor);
            drawn = false;
          }
          EvtGetPen(&newPointX, &newPointY, &isPenDown);
        }
        FntSetFont(oldFont);
      } else {
        handled = true;
      }
    } else {
      gExamsSelRow=event->data.tblEnter.row;
      for (i=0; i < TblGetNumberOfRows(event->data.tblEnter.pTable); ++i) {
        RectangleType r;
        TblGetItemBounds(event->data.tblEnter.pTable, i, EXCOL_SELI, &r);
        TableDrawSelection(event->data.tblEnter.pTable, i, event->data.tblEnter.column, &r);
      }
      handled=true;
    }
  } else if (event->eType == tblSelectEvent) {
    if (event->data.tblEnter.column == EXCOL_DONE) {
      MemHandle mex;
      ExamDBRecord *ex;
      Boolean done=(TblGetItemInt(event->data.tblSelect.pTable, event->data.tblSelect.row, event->data.tblSelect.column) == 0) ? false : true;
      UInt16 flags, index=TblGetRowID(event->data.tblSelect.pTable, event->data.tblSelect.row);

      mex=DmGetRecord(DatabaseGetRefN(DB_MAIN), index);
      ex = MemHandleLock(mex);
      flags = ex->flags;

      if (done) {
        flags |= EX_FLAG_DONE;
      } else {
        flags &= (EX_FLAG_DONE ^ 0xFFFF);
      }

      DmWrite(ex, offsetof(ExamDBRecord, flags), &flags, sizeof(flags));
      DmReleaseRecord(DatabaseGetRefN(DB_MAIN), index, false);

      TblMarkRowInvalid(event->data.tblSelect.pTable, event->data.tblSelect.row);
      TblRedrawTable(event->data.tblSelect.pTable);

      MemHandleUnlock(mex);

    } else if (event->data.tblEnter.column == EXCOL_NOTE) {
      ControlType *ctl=GetObjectPtr(BUTTON_ex_note);
      // Don't need code twice, just read ctlSelect Event for BUTTON_ex_note
      CtlHitControl(ctl);
    }
    handled=true;
  } else if (event->eType == ctlRepeatEvent) {
    // Repeat buttons pressed
    if( event->data.ctlRepeat.controlID == REPEAT_ex_up )
      gExamsOffset -= 1;
    else
      gExamsOffset += 1;

    ExamsTableInit();
    TblMarkTableInvalid(GetObjectPtr(TABLE_exams));
    TblRedrawTable(GetObjectPtr(TABLE_exams));
  } else if (event->eType == keyDownEvent) {
    // We have a hard button assigned and it was pressed
    if (TxtCharIsHardKey(event->data.keyDown.modifiers, event->data.keyDown.chr)) {
      if (! (event->data.keyDown.modifiers & poweredOnKeyMask)) {
        FrmGotoForm(FORM_main);
        handled = true;
      }
    }
  } else if (event->eType == menuOpenEvent) {
    return HandleMenuOpenEvent(event);
  } else if (event->eType == menuEvent) {
    // forwarding of menu events
    return HandleMenuEvent(event->data.menu.itemID);
  } else if (event->eType == frmOpenEvent) {
    // initializes and draws the form
    ControlType *ctl;

    gExamsOffset=0;
    ExamsTableInit();
    FrmDrawForm (frm);

    ctl = GetObjectPtr(LIST_ex_cat_trigger);
    CategoryGetName (DatabaseGetRef(), DatabaseGetCat(), gCategoryName); 
    CategorySetTriggerLabel (ctl, gCategoryName); 

    handled = true;
  } else if (event->eType == frmUpdateEvent) {
    // redraws the form if needed
    gExamsOffset=0;
    ExamsTableInit();
    FrmDrawForm(frm);
    handled = false;
  } else if (event->eType == frmCloseEvent) {
    // this is done if form is closed
    // TblEraseTable(GetObjectPtr(TABLE_exams));
    // ExamsFormFree();
    FrmEraseForm(frm);
  }

  return (handled);

}
예제 #16
0
파일: main_form.c 프로젝트: kjk/noah-palm
static Boolean MainFormHandleEvent(EventType* event)
{
    AppContext* appContext=GetAppContext();
    FormType* form=FrmGetFormPtr(formDictMain);
    Boolean handled=false;
    switch (event->eType)
    {
        case winDisplayChangedEvent:
            handled=MainFormDisplayChanged(appContext, form);
            break;
            
        case frmOpenEvent:
            handled=MainFormOpen(appContext, form, event);
            break;   
            
        case frmUpdateEvent:
            MainFormDraw(appContext, form, event->data.frmUpdate.updateCode);
            handled=true;
            break; 
            
        case ctlSelectEvent:
            handled=MainFormControlSelected(appContext, form, event);
            break;

        case keyDownEvent:
            handled = MainFormKeyDown(appContext, form, event);
            break;

        case sclRepeatEvent:
//        case sclExitEvent:
            handled=MainFormScrollExit(appContext, form, event);
            break;
            
        case menuEvent:
            handled=MainFormMenuCommand(appContext, form, event);
            break;
            
        case penDownEvent:
            if ((mainFormShowsDefinition != appContext->mainFormContent) || (event->screenX > appContext->screenWidth-FRM_RSV_W) || (event->screenY > appContext->screenHeight-FRM_RSV_H))
                break;
            cbPenDownEvent(appContext,event->screenX,event->screenY);
            handled = true;
            break;

        case penMoveEvent:
            cbPenMoveEvent(appContext,event->screenX,event->screenY);
            handled = true;
            break;

        case penUpEvent:
            cbPenUpEvent(appContext,event->screenX,event->screenY);
            handled = true;
            break;

        case connectionProgressEvent:
            MainFormHandleConnectionProgress(appContext, form, event);
            handled=true;
            break;            

        case evtRefresh:
            FrmUpdateForm(formDictMain, redrawAll);
            handled=true;
            break;

        case evtShowMalformedAlert:
            FrmAlert(alertMalformedResponse);
            handled=true;
            break;

        case evtRegistrationFailed:
            MainFormHandleWrongRegCode(appContext);
            FrmUpdateForm(formDictMain, redrawAll); 
            handled=true;
            break;

        case evtRegistrationOk:
            FrmAlert(alertRegistrationOk);
            // FrmUpdateForm(formDictMain, redrawAll); 
            handled=true;
            break;

        case evtConnectionFinished:
#ifdef DEBUG
            if (appContext->fInStress)
            {
                LookupRandomWord(appContext);
            }
#endif
            handled=true;
            break;
    }
    return handled;
}
예제 #17
0
파일: main_form.c 프로젝트: kjk/noah-palm
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;
}
예제 #18
0
파일: main_form.c 프로젝트: kjk/noah-palm
inline static void MainFormHandleAbout(AppContext* appContext)
{
    appContext->mainFormContent=mainFormShowsAbout;
    cbNoSelection(appContext);
    FrmUpdateForm(formDictMain, redrawAll);    
}
예제 #19
0
Boolean AnnotationFormHandleEvent
    (
    EventType* event  /* pointer to an EventType structure */
    )
{
    Boolean     handled;

    handled = ResizeHandleEvent( event );

    if ( handled )
        return handled;

    switch ( event->eType ) {
        case frmOpenEvent:
            AnnotationFormInit();
            handled = true;
            break;
            
        case keyDownEvent:
            switch ( event->data.keyDown.chr ) {
                case pageUpChr:
                    if ( FldScrollable( field, winUp ) )
                        FldScrollField( field, 1, winUp );
                    UpdateFieldScrollbar( field, scrollBar );
                    break;

                case pageDownChr:
                    if ( FldScrollable( field, winDown ) )
                        FldScrollField( field, 1, winDown );
                    UpdateFieldScrollbar( field, scrollBar );
                    break;

                default: {
                    UInt16 scrollPos;
                    UInt16 textHeight;
                    UInt16 fieldHeight;

                    FldGetScrollValues( field, &scrollPos, &textHeight, &fieldHeight );

                    if ( FldHandleEvent( field, event ) ) {
                        UInt16 newScrollPos;
                        UInt16 newTextHeight;
                        UInt16 newFieldHeight;

                        FldGetScrollValues( field, &newScrollPos, 
                            &newTextHeight, &newFieldHeight );

                        if ( scrollPos != newScrollPos || textHeight != newTextHeight ||
                             fieldHeight != newFieldHeight )
                            UpdateFieldScrollbar( field, scrollBar );
                            
                        handled = true;
                    }
                    break;
                }
            }
            break;

        case sclRepeatEvent:
            ScrollMessage( field, event->data.sclRepeat.newValue -
                                         event->data.sclRepeat.value );
            break;

        case ctlSelectEvent:
            switch ( event->data.ctlSelect.controlID ){
                case frmAnnotationCancel:
                	AnnotationFormClose();
                    FrmReturnToForm( Prefs()->lastForm );
                    handled = true;
                    break;

                case frmAnnotationOK:
                	SaveAnnotation();
                	AnnotationFormClose();
                    FrmReturnToForm( Prefs()->lastForm );
                    if ( IsFormMain( Prefs()->lastForm ) )
                        FrmUpdateForm( GetMainFormId(), frmRedrawUpdateCode );
  	            handled = true;
                    break;

                case frmAnnotationDelete:
                    if ( entryP->id.indexInParagraph != NEW_ANNOTATION ) {
                        DeleteAnnotation( &( entryP->id ) );
                    }
                	AnnotationFormClose();
                    if ( IsFormMain( Prefs()->lastForm ) )
                        FrmUpdateForm( GetMainFormId(), frmRedrawUpdateCode );
                    FrmReturnToForm( Prefs()->lastForm );
                    handled = true;
                    break;

                default:
                    handled = true;
                    break;
            }
            break;

        case frmCloseEvent:
            AnnotationFormClose();
            handled = false;
            break;

        default:
            handled = false;
    }
    return handled;
}
예제 #20
0
/* Perform action for specified select type */
void DoSelectTypeAction
    (
    SelectType selection    /* selection type */
    )
{
    if ( IsMainFormWinActive() || IsFullscreenformActive()
         || FrmGetActiveFormID() == frmLibrary ) {
        if ( IsMainFormWinActive() &&
             selection != SELECT_TOGGLE_AUTOSCROLL &&
             selection != SELECT_INCREASE_AUTOSCROLL &&
             selection != SELECT_DECREASE_AUTOSCROLL &&
             selection != SELECT_FULL_PAGE_UP &&
             selection != SELECT_FULL_PAGE_DOWN &&
             selection != SELECT_HALF_PAGE_UP &&
             selection != SELECT_HALF_PAGE_DOWN &&
             selection != SELECT_ONE_LINE_UP &&
             selection != SELECT_ONE_LINE_DOWN ) {
            DoAutoscrollToggle( AUTOSCROLL_OFF );
        }
        switch ( selection ) {
            case SELECT_NONE:
                break;

#ifdef SUPPORT_WORD_LOOKUP
#ifdef SUPPORT_PPI
            case SELECT_WORD_LOOKUP_PPI:
                isSelectWordTapMode = ! isSelectWordTapMode;
                selectedWordAction  = SELECT_WORD_PPI;
                ShowSelectWordTapIcon();
                break;
#endif
#ifdef SUPPORT_ANNOTATION
            case SELECT_WORD_LOOKUP_ANNOTATE:
                isSelectWordTapMode = ! isSelectWordTapMode;
                selectedWordAction  = SELECT_WORD_ANNOTATE;
                ShowSelectWordTapIcon();
                break;
#endif
            case SELECT_WORD_LOOKUP_SEARCH_FORM:
                isSelectWordTapMode = ! isSelectWordTapMode;
                selectedWordAction  = SELECT_WORD_SEARCH_FORM;
                ShowSelectWordTapIcon();
                break;
            case SELECT_WORD_LOOKUP_TO_CLIPBOARD:
                isSelectWordTapMode = ! isSelectWordTapMode;
                selectedWordAction  = SELECT_WORD_TO_CLIPBOARD;
                ShowSelectWordTapIcon();
                break;
#endif

            case SELECT_SAVE_POSITION:
                AddToHistory( GetCurrentRecordId() );
                break;

            case SELECT_BRIGHTNESS_ADJUST:
                EmitKey( vchrBrightness, commandKeyMask );
                break;

            case SELECT_TOGGLE_BACKLIGHT:
                EmitKey( vchrBacklight, commandKeyMask );
                break;
                
            case SELECT_CONTRAST_ADJUST:
                EmitKey( vchrContrast, commandKeyMask );
                break;

            case SELECT_ONE_LINE_UP:
                DoPageMove( GetDefaultMainStyleHeight() );
                break;

            case SELECT_ONE_LINE_DOWN:
                DoPageMove( -GetDefaultMainStyleHeight() );
                break;

            case SELECT_FULL_PAGE_UP:
                if ( Prefs()->autoscrollEnabled &&
                     Prefs()->autoscrollDir == AUTOSCROLL_UP )
                    DoAutoscrollIncr();
                else if ( Prefs()->autoscrollEnabled )
                    DoAutoscrollDecr();
                else if ( Prefs()->pageControlsLink && OnFirstScreen() &&
                          NO_RECORD == GetSequentialRecordId( DIRECTION_UP ) )
                    GoToFirstAnchor();
                else
                    DoPageMove( RotGetScrollValue() );
                break;

            case SELECT_HALF_PAGE_UP:
                if ( Prefs()->autoscrollEnabled &&
                     Prefs()->autoscrollDir == AUTOSCROLL_UP )
                    DoAutoscrollIncr();
                else if ( Prefs()->autoscrollEnabled )
                    DoAutoscrollDecr();
                else if ( Prefs()->pageControlsLink && OnFirstScreen() &&
                          NO_RECORD == GetSequentialRecordId( DIRECTION_UP ) )
                    GoToFirstAnchor();
                else
                    DoPageMove( RotGetScrollValue() / 2 );
                break;

            case SELECT_FULL_PAGE_DOWN:
                if ( Prefs()->autoscrollEnabled &&
                     Prefs()->autoscrollDir == AUTOSCROLL_UP )
                    DoAutoscrollDecr();
                else if ( Prefs()->autoscrollEnabled )
                    DoAutoscrollIncr();
                else if ( Prefs()->pageControlsLink && OnLastScreen() )
                    GoToLastAnchor();
                else
                    DoPageMove( -RotGetScrollValue() );
                break;

            case SELECT_HALF_PAGE_DOWN:
                if ( Prefs()->autoscrollEnabled &&
                     Prefs()->autoscrollDir == AUTOSCROLL_UP )
                    DoAutoscrollDecr();
                else if ( Prefs()->autoscrollEnabled )
                    DoAutoscrollIncr();
                else if ( Prefs()->pageControlsLink && OnLastScreen() )
                    GoToLastAnchor();
                else
                    DoPageMove( -RotGetScrollValue() / 2 );
                break;

            case SELECT_GO_BACK:
                if ( IsFullscreenformActive() )
                    FsDoControlAction( -( LEFTCONTROL + 1 ) );
                else
                    DoControlAction( -( LEFTCONTROL + 1 ) );
                break;

            case SELECT_GO_FORWARD:
                if ( IsFullscreenformActive() )
                    FsDoControlAction( -( RIGHTCONTROL + 1 ) );
                else
                    DoControlAction( -( RIGHTCONTROL + 1 ) );
                break;

            case SELECT_GO_HOME:
                if ( IsFullscreenformActive() )
                    FsDoControlAction( -( HOMECONTROL + 1 ) );
                else
                    DoControlAction( -( HOMECONTROL + 1 ) );
                break;

            case SELECT_GO_TO_TOP:
                if ( IsFullscreenformActive() )
                    FsAdjustVerticalOffset( FULLSCREEN_TOP );
                else
                    GotoLocation( TOP );
                break;

            case SELECT_GO_TO_BOTTOM:
                if ( IsFullscreenformActive() )
                    FsAdjustVerticalOffset( FULLSCREEN_BOTTOM );
                else
                    GotoLocation( BOTTOM );
                break;

            case SELECT_FIND:
                FrmPopupForm( frmSearch );
                break;

            case SELECT_FIND_AGAIN:
                SearchAgain();
                break;

            case SELECT_ADD_BOOKMARK:
                DoAddBookmark();
                break;

            case SELECT_VIEW_BOOKMARKS:
                FrmPopupForm( frmBookmarks );
                break;

            case SELECT_OPEN_LIBRARY:
                CloseDocument();
                FrmGotoForm( GetValidForm( frmLibrary ) );
                break;

            case SELECT_DETAILS:
                FrmPopupForm( frmDetails );
                break;

            case SELECT_PREFS:
                FrmGotoForm( frmPrefs );
                break;

            case SELECT_BUTTON_ACTION:
                PrefsButtonShowFirst();
                FrmGotoForm( frmPrefs );
                break;

            case SELECT_TAP_ACTION:
                PrefsControlShowFirst();
                FrmGotoForm( frmPrefs );
                break;

            case SELECT_GESTURE_ACTION:
                PrefsGestureShowFirst();
                FrmGotoForm( frmPrefs );
                break;

            case SELECT_TOGGLE_AUTOSCROLL:
                DoAutoscrollToggle( AUTOSCROLL_TOGGLE );
                break;

            case SELECT_INCREASE_AUTOSCROLL:
                DoAutoscrollIncr();
                break;
                
            case SELECT_DECREASE_AUTOSCROLL:
                DoAutoscrollDecr();
                break;

            case SELECT_NEXT_ANCHOR:
                HandleNextControl();
                break;

            case SELECT_PREV_ANCHOR:
                HandlePrevControl();
                break;

            case SELECT_GO_TO_LINK:
                if ( IsFullscreenformActive() ) {
                    if ( 0 < actualAnchor )
                        FsDoControlAction( actualAnchor );
                } else {
                    DoControlAction( actualAnchor );
                }
                break;

            case SELECT_COPY_TO_MEMO:
                DoHardcopy();
                break;

            case SELECT_DELETE_DOCUMENT:
                DoDeleteDocument();
                break;

            case SELECT_FONT:
                PrefsFontShowFirst();
                FrmGotoForm( frmPrefs );
                break;

            case SELECT_COMMAND_STROKE:
                EmitKey( vchrCommand, commandKeyMask );
                break;

            case SELECT_MENU:
                EmitKey( vchrMenu, commandKeyMask );
                break;

#ifdef HAVE_ROTATE
            case SELECT_ROTATE_LEFT: {
                RotateType angle;
                angle = Prefs()->rotate;
                switch ( angle ) {
                    case ROTATE_ZERO:
                        angle = ROTATE_PLUS90;
                        break;
                    case ROTATE_PLUS90:
                        angle = ROTATE_MINUS90;
                        break;
                    case ROTATE_MINUS90:
                        angle = ROTATE_ZERO;
                }
                if ( Prefs()->individualDocumentLayout )
                    GetHistoryPtr()->rotate = angle;
                else
                    Prefs()->rotate = angle;
                FrmUpdateForm( Prefs()->lastForm, frmRedrawUpdateCode );
                break;
            }

            case SELECT_ROTATE_RIGHT: {
                RotateType angle;
                angle = Prefs()->rotate;
                switch ( angle ) {
                    case ROTATE_PLUS90:
                        angle = ROTATE_ZERO;
                        break;
                    case ROTATE_MINUS90:
                        angle = ROTATE_PLUS90;
                        break;
                    case ROTATE_ZERO:
                        angle = ROTATE_MINUS90;
                        break;
                }
                if ( Prefs()->individualDocumentLayout )
                    GetHistoryPtr()->rotate = angle;
                else
                    Prefs()->rotate = angle;
                FrmUpdateForm( Prefs()->lastForm, frmRedrawUpdateCode );
                break;
            }
#endif

            case SELECT_TOGGLE_TOOLBAR:
                if ( ! IsFormMain( Prefs()->lastForm ) )
                    break;
                if ( Prefs()->toolbar != TOOLBAR_NONE ) {
                    Prefs()->savedToolbar = Prefs()->toolbar;
                    Prefs()->toolbar      = TOOLBAR_NONE;
                }
                else {
                    if ( Prefs()->savedToolbar == TOOLBAR_NONE )
                        Prefs()->toolbar = TOOLBAR_TOP;
                    else
                        Prefs()->toolbar = Prefs()->savedToolbar;
                }
#ifdef HAVE_SILKSCREEN
                if ( GetDIAState() == DIA_STATE_NO_STATUS_BAR &&
                   Prefs()->toolbar != TOOLBAR_NONE )
                    SetDIAState( Prefs()->savedSilkscreen );
#endif
                FrmUpdateForm( Prefs()->lastForm, frmRedrawUpdateCode );
                break;

            case SELECT_TOGGLE_FULLSCREEN: {
                UInt16       newToolbarState;
                UInt16       newScrollbarState;
                DIAStateType newDIAState;
                if ( Prefs()->toolbar == TOOLBAR_NONE &&
                    Prefs()->scrollbar == SCROLLBAR_NONE
                   ) {
                    /* From fullscreen to non-fullscreen */
                    if ( Prefs()->savedToolbar == TOOLBAR_NONE &&
                         Prefs()->savedScrollbar == SCROLLBAR_NONE ) {
                        Prefs()->savedToolbar   = TOOLBAR_TOP;
                        Prefs()->savedScrollbar = SCROLLBAR_RIGHT;
                    }
                    if ( Prefs()->savedSilkscreen == DIA_STATE_NO_STATUS_BAR ) {
                        Prefs()->savedSilkscreen = DIA_STATE_MIN;
                    }
                    newToolbarState   = Prefs()->savedToolbar;
                    newScrollbarState = Prefs()->savedScrollbar;
                    newDIAState       = Prefs()->savedSilkscreen;
                }
                else {
                    /* From non-fullscreen to fullscreen */
                    newToolbarState   = TOOLBAR_NONE;
                    newScrollbarState = SCROLLBAR_NONE;
                    newDIAState       = DIA_STATE_NO_STATUS_BAR;
                }
                Prefs()->savedToolbar    = Prefs()->toolbar;
                Prefs()->savedScrollbar  = Prefs()->scrollbar;
                Prefs()->savedSilkscreen = GetDIAState();
                Prefs()->toolbar         = newToolbarState;
                Prefs()->scrollbar       = newScrollbarState;
                SetDIAState( newDIAState );
                FrmUpdateForm( Prefs()->lastForm, frmRedrawUpdateCode );
                break;
            }

            default:
                break;
        }
    }
}