Пример #1
0
//---------------------------------------------------------------------------
void __fastcall DoAboutDialog(TConfiguration * Configuration,
  bool AllowLicense, TRegistration * Registration)
{
  try
  {
    DoAboutDialog(Configuration, AllowLicense, Registration, true);
  }
  catch (EOleException & E)
  {
    // This happens particularly on Wine that's does not support some
    // functionality of embedded IE we need.
    DoAboutDialog(Configuration, AllowLicense, Registration, false);
  }
}
Пример #2
0
/***********************************************************************
 *
 * FUNCTION:    ThumbnailViewHandleEvent
 *
 * DESCRIPTION: This routine is the event handler for the "Thumbnail View"
 *              of the Record application.
 *
 * PARAMETERS:  event  - a pointer to an EventType structure
 *
 * RETURNED:    true if the event was handled and should not be passed
 *              to a higher level handler.
 *
 ***********************************************************************/
Boolean ThumbnailViewHandleEvent (EventPtr event) {
  FormPtr frm = NULL;
  Boolean handled = false;

  switch (event->eType) {
  case keyDownEvent:
    /* Hardware button pressed? */
    if (TxtCharIsHardKey(event->data.keyDown.modifiers, event->data.keyDown.chr)) {
      if (!(event->data.keyDown.modifiers & poweredOnKeyMask))
    ThumbnailViewNextCategory();
      handled = true;
    } else if (EvtKeydownIsVirtual(event)) {
      switch (event->data.keyDown.chr) {
      case vchrPageUp:
      case vchrRockerUp:
    if (d.fiveWayNavigation) {
      /* Deselect previous item */
      ToggleButton(d.thumbnailX, d.thumbnailY, false);
      
      /* Select new item, scroll if necessary */
      if (ThumbnailViewMoveCursorUp())
        ThumbnailViewScroll(-1);
      UpdateButtonAndIndex();
    } else {
      ThumbnailViewPageScroll(winUp);
    }
    handled = true;
    break;

      case vchrPageDown:
      case vchrRockerDown:
    if (d.fiveWayNavigation) {
      /* Deselect previous item */
      ToggleButton(d.thumbnailX, d.thumbnailY, false);
      
      /* Select new item, scroll if necessary */
      if (ThumbnailViewMoveCursorDown())
        ThumbnailViewScroll(1);
      UpdateButtonAndIndex();
    } else {
      ThumbnailViewPageScroll(winDown);
    }
    handled = true;
    break;
    
    /* Treo 600 5-way navigation */
      case vchrRockerCenter:
    handled = ThumbnailViewHandleFiveWayNavSelect();
    break;
      case vchrRockerLeft:
    handled = ThumbnailViewHandleFiveWayNavLeft();
    break;
      case vchrRockerRight:
    handled = ThumbnailViewHandleFiveWayNavRight();
    break;

    /* Tungsten 5-way navigation */
      case vchrNavChange:
    if (NavDirectionPressed(event, Left))
      handled = ThumbnailViewHandleFiveWayNavLeft();
    else if (NavDirectionPressed(event, Right))
      handled = ThumbnailViewHandleFiveWayNavRight();
    else if (NavSelectPressed(event))
      handled = ThumbnailViewHandleFiveWayNavSelect();
    break;

/*       case vchrSendData: */
/*  ThumbnailViewDoCommand(ThumbnailRecordBeamCategoryCmd); */
/*  handled = true; */
/*  break; */

      default:
    /* ignore */
      }
    }
    break;

  case ctlSelectEvent:
    switch (event->data.ctlSelect.controlID) {
    case NewButton:
      /* Create new sketch after all existing ones */
      p.dbI = DmNumRecords(d.dbR);

      AllocImage();
      FrmGotoForm(p.flags & PFLAGS_WITH_TITLEBAR ? DiddleTForm : DiddleForm);
      handled = true;
      break;

    case CategoryPop:
      ThumbnailViewSelectCategory();
      handled = true;
      break;

    case TextListButton:
      FrmGotoForm(DiddleListForm);
      handled = true;
      break;

    case ThumbnailDetailListButton:
      FrmGotoForm(DiddleThumbnailDetailForm);
      handled = true;
      break;
    }
    break;

  case frmGotoEvent:
    p.dbI = event->data.frmGoto.recordNum;
    SwitchCategoryForGoto();
    FrmGotoForm(p.flags & PFLAGS_WITH_TITLEBAR ? DiddleTForm : DiddleForm);
    event->eType = dbOpenRecordFieldEvent;
    EvtAddEventToQueue(event);

    handled = true;
    break;

  case menuEvent:
    {
      Char chr = 0;

      switch(event->data.menu.itemID) {
      case menuitemID_CmdAbout:
    DoAboutDialog();
    handled = true;
    break;

      case menuitemID_CmdSecurity:
    ThumbnailDoCmdSecurity();
    handled = true;
    break;

      case menuitemID_CmdSortByAlarm:      
      case menuitemID_CmdSortByName:
    if (event->data.menu.itemID == menuitemID_CmdSortByAlarm)
      DmInsertionSort(d.dbR, &SortByAlarmTime, 0);
    else
      DmInsertionSort(d.dbR, &SortByName, 0);

        SetTopVisibleRecord(0);
    ThumbnailViewLoadRecords(FrmGetActiveForm());
    handled = true;
    break;

      case menuitemID_CmdPref: chr=cmdPref; break;
      case menuitemID_CmdExtPref: chr=cmdExtPref; break;
      case menuitemID_CmdHWPref: chr=cmdHWPref; break;
      case menuitemID_CmdAlarmPref: chr=cmdAlarmPref; break;
      case menuitemID_CmdHelp: chr=cmdHelp; break;
      }

      if (!handled)
    handled = KeyDown(chr);
    }
    break;

  case frmOpenEvent:
    frm = FrmGetActiveForm();
    ThumbnailViewInit(frm);
    FrmDrawForm(frm);

    /* Disable 5-way navigation initially */
    d.fiveWayNavigation = false;

    /* Clean up */
    if (d.record_name) MemHandleFree(d.record_name);
    d.record_name = NULL;
    if (d.record_note) MemHandleFree(d.record_note);
    d.record_note = NULL;

    handled = true;
    break;

  case frmUpdateEvent:
    handled = ThumbnailViewUpdateDisplay(event->data.frmUpdate.updateCode);
    break;

  case menuCmdBarOpenEvent:
    MenuCmdBarAddButton(menuCmdBarOnLeft, BarSecureBitmap,
            menuCmdBarResultMenuItem, menuitemID_CmdSecurity, 0);

    /* Tell the field package to not add buttons automatically; */
    /* we've done it all ourselves.                             */
    event->data.menuCmdBarOpen.preventFieldButtons = true;

    /* don't set handled to true; this event must fall through to the system. */
    break;

  case sclRepeatEvent:
    ThumbnailViewScroll (event->data.sclRepeat.newValue - event->data.sclRepeat.value);
    break;

  case dbNonKeyCommandEvent:
    handled = HandleNonKeyCommandCode(event->data.menu.itemID);
    break;

/*   case frmObjectFocusTakeEvent: */
/*     { */
/*       RectangleType r; */
/*       FormType* frm = FrmGetFormPtr(event->data.frmObjectFocusTake.formID); */
/*       const UInt16 id = event->data.frmObjectFocusTake.objectID; */
/*       const UInt16 idx = FrmGetObjectIndex(frm, id); */

/*       if (id >= Thumb1 && id <= Thumb30) { */
/*  FrmGetObjectBounds(frm, idx, &r); */
/*  FrmSetFocus(frm, idx); */
/*  HsNavDrawFocusRing(frm, id, hsNavFocusRingNoExtraInfo, &r, */
/*             hsNavFocusRingStyleObjectTypeDefault, false); */
/*  handled = true; */
/*       } */
/*     } */
/*     break; */

  default:
    /* do nothing */
  }

  return handled;
}