Revision: 14684
          http://sourceforge.net/p/edk2/code/14684
Author:   vanjeff
Date:     2013-09-18 02:53:10 +0000 (Wed, 18 Sep 2013)
Log Message:
-----------
Sync patch r14678 from main trunk.
Export one interface to support 3rd party to change question attribute, such as 
hide/gray out.

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/14678

Modified Paths:
--------------
    branches/UDK2010.SR1/MdeModulePkg/Include/Protocol/DisplayProtocol.h
    branches/UDK2010.SR1/MdeModulePkg/Include/Protocol/FormBrowserEx2.h
    branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
    branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
    branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h

Modified: branches/UDK2010.SR1/MdeModulePkg/Include/Protocol/DisplayProtocol.h
===================================================================
--- branches/UDK2010.SR1/MdeModulePkg/Include/Protocol/DisplayProtocol.h        
2013-09-18 02:52:32 UTC (rev 14683)
+++ branches/UDK2010.SR1/MdeModulePkg/Include/Protocol/DisplayProtocol.h        
2013-09-18 02:53:10 UTC (rev 14684)
@@ -137,10 +137,12 @@
 //
 // Attribute for Statement and Form
 //
+#define HII_DISPLAY_NONE             0
 #define HII_DISPLAY_GRAYOUT          BIT0
 #define HII_DISPLAY_LOCK             BIT1
 #define HII_DISPLAY_READONLY         BIT2
 #define HII_DISPLAY_MODAL            BIT3
+#define HII_DISPLAY_SUPPRESS         BIT4
 
 struct _FORM_DISPLAY_ENGINE_STATEMENT{
   UINTN                 Signature;

Modified: branches/UDK2010.SR1/MdeModulePkg/Include/Protocol/FormBrowserEx2.h
===================================================================
--- branches/UDK2010.SR1/MdeModulePkg/Include/Protocol/FormBrowserEx2.h 
2013-09-18 02:52:32 UTC (rev 14683)
+++ branches/UDK2010.SR1/MdeModulePkg/Include/Protocol/FormBrowserEx2.h 
2013-09-18 02:53:10 UTC (rev 14684)
@@ -68,6 +68,21 @@
 
 #define FORM_ENTRY_INFO_FROM_LINK(a)  CR (a, FORM_ENTRY_INFO, Link, 
FORM_ENTRY_INFO_SIGNATURE)
 
+#define FORM_QUESTION_ATTRIBUTE_OVERRIDE_SIGNATURE    SIGNATURE_32 ('f', 'q', 
'o', 's')
+
+typedef struct {
+  UINTN            Signature;
+  LIST_ENTRY       Link;
+
+  EFI_QUESTION_ID  QuestionId;           // Find the question
+  EFI_FORM_ID      FormId;               // Find the form
+  EFI_GUID         FormSetGuid;          // Find the formset.
+  EFI_HII_HANDLE   HiiHandle;            // Find the HII handle
+  UINT32           Attribute;            // Hide or grayout ... 
+} QUESTION_ATTRIBUTE_OVERRIDE;
+
+#define FORM_QUESTION_ATTRIBUTE_OVERRIDE_FROM_LINK(a)  CR (a, 
QUESTION_ATTRIBUTE_OVERRIDE, Link, FORM_QUESTION_ATTRIBUTE_OVERRIDE_SIGNATURE)
+
 struct _EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL {
   ///
   /// Version for protocol future extension.
@@ -82,6 +97,10 @@
   /// A list of type FORMID_INFO is Browser View Form History List.
   ///
   LIST_ENTRY                FormViewHistoryHead;
+  ///
+  /// A list of type QUESTION_ATTRIBUTE_OVERRIDE.
+  ///
+  LIST_ENTRY                OverrideQestListHead;
 };
 
 extern EFI_GUID gEdkiiFormBrowserEx2ProtocolGuid;

Modified: 
branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
===================================================================
--- branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c  
2013-09-18 02:52:32 UTC (rev 14683)
+++ branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c  
2013-09-18 02:53:10 UTC (rev 14684)
@@ -533,6 +533,47 @@
 
 /**
 
+  Get the extra question attribute from override question list.
+
+  @param    QuestionId    The question id for this request question.
+
+  @retval   The attribute for this question or NULL if not found this 
+            question in the list.
+
+**/
+UINT32 
+ProcessQuestionExtraAttr (
+  IN   EFI_QUESTION_ID  QuestionId
+  )
+{
+  LIST_ENTRY                   *Link;
+  QUESTION_ATTRIBUTE_OVERRIDE  *QuestionDesc;
+
+  //
+  // Return HII_DISPLAY_NONE if input a invalid question id.
+  //
+  if (QuestionId == 0) {
+    return HII_DISPLAY_NONE;
+  }
+
+  Link = GetFirstNode (&mPrivateData.FormBrowserEx2.OverrideQestListHead);
+  while (!IsNull (&mPrivateData.FormBrowserEx2.OverrideQestListHead, Link)) {
+    QuestionDesc = FORM_QUESTION_ATTRIBUTE_OVERRIDE_FROM_LINK (Link);
+    Link = GetNextNode (&mPrivateData.FormBrowserEx2.OverrideQestListHead, 
Link);
+
+    if ((QuestionDesc->QuestionId == QuestionId) &&
+        (QuestionDesc->FormId     == gCurrentSelection->FormId) &&
+        (QuestionDesc->HiiHandle  == gCurrentSelection->Handle) &&
+        CompareGuid (&QuestionDesc->FormSetGuid, 
&gCurrentSelection->FormSetGuid)) {
+      return QuestionDesc->Attribute;
+    }
+  }
+
+  return HII_DISPLAY_NONE;
+}
+
+/**
+
   Enum all statement in current form, find all the statement can be display and
   add to the display form.
 
@@ -551,6 +592,7 @@
   EFI_EVENT                     RefreshIntervalEvent;
   FORM_BROWSER_REFRESH_EVENT_NODE *EventNode;
   BOOLEAN                       FormEditable;
+  UINT32                        ExtraAttribute;
 
   HostDisplayStatement = NULL;
   MinRefreshInterval   = 0;
@@ -592,6 +634,14 @@
       continue;
     }
 
+    //
+    // Check the extra attribute.
+    //
+    ExtraAttribute = ProcessQuestionExtraAttr (Statement->QuestionId);
+    if ((ExtraAttribute & HII_DISPLAY_SUPPRESS) != 0) {
+      continue;
+    }
+
     DisplayStatement = AllocateZeroPool (sizeof 
(FORM_DISPLAY_ENGINE_STATEMENT));
     ASSERT (DisplayStatement != NULL);
 
@@ -601,6 +651,11 @@
     InitializeDisplayStatement(DisplayStatement, Statement, 
HostDisplayStatement);
 
     //
+    // Set the extra attribute.
+    //
+    DisplayStatement->Attribute |= ExtraAttribute;
+
+    //
     // Save the Host statement info.
     // Host statement may has nest statement follow it.
     //

Modified: branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
===================================================================
--- branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c 
2013-09-18 02:52:32 UTC (rev 14683)
+++ branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c 
2013-09-18 02:53:10 UTC (rev 14684)
@@ -766,7 +766,8 @@
   //
   // Install FormBrowserEx2 protocol
   //
-  InitializeListHead (&mPrivateData.FormBrowserEx2.FormViewHistoryHead);  
+  InitializeListHead (&mPrivateData.FormBrowserEx2.FormViewHistoryHead);
+  InitializeListHead (&mPrivateData.FormBrowserEx2.OverrideQestListHead);
   mPrivateData.Handle = NULL;
   Status = gBS->InstallProtocolInterface (
                   &mPrivateData.Handle,

Modified: branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
===================================================================
--- branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h 
2013-09-18 02:52:32 UTC (rev 14683)
+++ branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h 
2013-09-18 02:53:10 UTC (rev 14684)
@@ -544,6 +544,7 @@
 extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
 extern EXIT_HANDLER          ExitHandlerFunction;
 extern EFI_HII_HANDLE        mCurrentHiiHandle;
+extern SETUP_DRIVER_PRIVATE_DATA mPrivateData;
 //
 // Browser Global Strings
 //

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to