Beispiel #1
0
void CPropInfo::ResetHotKeys()
{
	// remove all pending changes
	if ( m_pcmAddKey )
	{
		free( m_pcmAddKey );
		m_pcmAddKey = NULL;
	}
	if ( m_pwAddCmd )
	{
		free( m_pwAddCmd );
		m_pwAddCmd = NULL;
	}
	if ( m_pcmRemoveKey )
	{
		free( m_pcmRemoveKey );
		m_pcmRemoveKey = NULL;
	}
	m_nAddCount = m_nRemoveCount = 0;

	// Now, add 'remove' records for all existing hotkeys
	for ( int i = 0; i < CEdit::g_nHotKeyCount; i++ )
	{
		CHotKey *pHotKey = CEdit::g_pHotKeys + i;
		if ( !CEdit::IsRegisteredCommand( pHotKey->wCmd ) )
        {
			RemoveHotKey( pHotKey->cmHotKey ); 
        }
	}

	// Now, add 'add' records for all default hotkeys
	for ( i = 0; i < CEdit::g_nDefHotKeyCount; i++ )
	{
		_defhotkeyrec *pHotKey = &CEdit::g_DefHotKeys[ i ];
		CM_HOTKEY cmHotKey = { pHotKey->fsModifiers1, pHotKey->nVirtKey1,
		                       pHotKey->fsModifiers2, pHotKey->nVirtKey2 };
		AddHotKey( cmHotKey, pHotKey->wCmd );
	}
}
Beispiel #2
0
EFI_STATUS
DisplayMainMenu (
  VOID
  )
/*++

Routine Description:

  Display the main menu

Returns:

  EFI_SUCCESS   - Display the menu successfully
  Other Value   - Something failed

--*/
{
  EFI_STATUS            Status;
  EFI_MENU_PAGE         *Page;
  EFI_DIALOG_CONTEXT    DialogContext;
  CHAR16                *DialogTitle;

  //
  // Create a standard menu
  //
  Status = CreateStandardMenuPage (
             L"Main Menu",
             &Page
             );
  if (EFI_ERROR(Status)) {
    return Status;
  }

  //
  // Main Menu Items
  //  - Test Case Management
  //  - Test Environment Configuration
  //  - Test Report Generator ...
  //  - Help
  //
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Test Case Management",
             L"Select and execute test cases",
             (VOID *)(UINTN)EFI_MENU_ITEM_CASE_MANAGEMENT,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Test Environment Configuration",
             L"Set configuration data for testing",
             (VOID *)(UINTN)EFI_MENU_ITEM_CONFIG,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Test Device Configuration",
             L"Set device configuration data for IHV's add-in card testing",
             (VOID *)(UINTN)EFI_MENU_ITEM_DEVICE_CONFIG,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"View Test Log ...",
             L"View test log",
             (VOID *)(UINTN)EFI_MENU_ITEM_VIEW_LOG,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Test Report Generator ...",
             L"Generate test report",
             (VOID *)(UINTN)EFI_MENU_ITEM_REPORT_GENERATOR,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

#if (EFI_SPECIFICATION_VERSION == 0x0001000A)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"EFI1.1 Self Certification Test is a toolkit to check an EFI1.1 "
             L"implementation is EFI1.1 Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#elif (EFI_SPECIFICATION_VERSION == 0x00020000)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"UEFI2.0 Self Certification Test is a toolkit to check an UEFI2.0 "
             L"implementation is UEFI2.0 Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#elif (EFI_SPECIFICATION_VERSION == 0x0002000A)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"UEFI2.1 Self Certification Test is a toolkit to check an UEFI2.1 "
             L"implementation is UEFI2.1 Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#elif (EFI_SPECIFICATION_VERSION == 0x0002001E)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"UEFI2.3 Self Certification Test is a toolkit to check an UEFI2.3 "
             L"implementation is UEFI2.3 Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#elif (EFI_SPECIFICATION_VERSION == 0x0002001F)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"UEFI2.3.1C Self Certification Test is a toolkit to check an UEFI2.3.1C "
             L"implementation is UEFI2.3.1C Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#endif  
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  //
  // Main Menu Hot Keys
  //  - Up, Down, Enter, Esc, F5, F6
  //
  Status = AddHotKey (
             L"Up/Dn",
             L"Select Item",
             SCAN_UP,
             CHAR_NULL,
             UpFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"Down",
             L"Select Item",
             SCAN_DOWN,
             CHAR_NULL,
             DownFunc,
             FALSE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"F4",
             L"Reset results",
             SCAN_F4,
             CHAR_NULL,
             MainMenuClearFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"F5",
             L"Load Sequence",
             SCAN_F5,
             CHAR_NULL,
             MainMenuLoadSeqFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR (Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"F6",
             L"Save Sequence",
             SCAN_F6,
             CHAR_NULL,
             MainMenuSaveSeqFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR (Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"Enter",
             L"Select SubMenu",
             SCAN_NULL,
             CHAR_CARRIAGE_RETURN,
             MainMenuEnterFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"ESC",
             L"Exit",
             SCAN_ESC,
             CHAR_NULL,
             MainMenuEscFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"F9",
             L"Run",
             SCAN_F9,
             CHAR_NULL,
             MainMenuF9Func,
             FALSE,
             Page
             );
  if (EFI_ERROR (Status)) {
    DestroyMenuPage (Page);
    return Status;
  }
  //
  // Display the main menu
  //
  MenuPageRefresh (Page);

  //
  //If start from recovery, remind user to continue running
  //
  if (!IsTestFinished () && !gForceExecution) {
    //
    //Execution was not finished in last time. Display yes or no dialog
    //
    DialogContext.Type = EFI_DIALOG_TYPE_YES_OR_NO;

    //
    //Set Yes as default choise
    //
    DialogContext.ChooseNumber = EFI_DIALOG_SELECT_YES;
    DialogTitle = StrDuplicate (L"Continue Run?");

    //
    //Display ask dialog
    //
    DoDialog (DialogTitle, &DialogContext);

    if (DialogContext.ChooseNumber == EFI_DIALOG_SELECT_YES) {

      //
      //Change to running background
      //
      ST->ConOut->SetAttribute (
                    ST->ConOut,
                    EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK
                    );
      ST->ConOut->ClearScreen (ST->ConOut);
      Status = SctContinueExecute ();
      gContinueExec = FALSE;
      if (EFI_ERROR (Status)) {
        EFI_SCT_DEBUG ((EFI_SCT_D_ERROR, L"Continue execute - %r", Status));
      }
    } else {

      //
      //user choose not to continue run immediatly, set global flag, let user to
      //continue run later
      //
      gContinueExec = TRUE;
    }
    MenuPageRefresh (Page);
  } else {

    //
    //not start from recovery mode
    //
    gContinueExec = FALSE;
  }

  //
  // Start to handle input keys
  //
  MenuPageKeyInput ();

  return EFI_SUCCESS;
}