summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-07-05 08:28:23 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-07-05 08:28:23 +0000
commit508b4e77f62b03e3af4bdd2b8fd1a53bdd6925a8 (patch)
tree565e23e3e2a17db58f92b792fa36e61adb5ba3d2 /MdeModulePkg/Universal
parent715cf6dd7e7ab5c42152983e72a3bfe84258ff6d (diff)
downloadedk2-platforms-508b4e77f62b03e3af4bdd2b8fd1a53bdd6925a8.tar.xz
Enable value roll over when hit max or min.
Update the maximum value when input day field in date opcode. Signed-off-by:ydong10 Reviewed-by:lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11977 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
index eee8eed244..d31a9b9ddc 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
@@ -299,7 +299,27 @@ GetNumericInput (
break;
case 1:
- Maximum = 31;
+ switch (QuestionValue->Value.date.Month) {
+ case 2:
+ if ((QuestionValue->Value.date.Year % 4) == 0 &&
+ (QuestionValue->Value.date.Year % 100) != 0 &&
+ (QuestionValue->Value.date.Year % 400) == 0) {
+ Maximum = 29;
+ } else {
+ Maximum = 28;
+ }
+ break;
+ case 4:
+ case 6:
+ case 9:
+ case 11:
+ Maximum = 30;
+ break;
+ default:
+ Maximum = 31;
+ break;
+ }
+
EraseLen = 3;
EditValue = QuestionValue->Value.date.Day;
break;
@@ -492,15 +512,20 @@ TheKey2:
if ((Step != 0) && !ManualInput) {
if (Key.ScanCode == SCAN_LEFT) {
- if (EditValue > Step) {
+ if (EditValue >= Minimum + Step) {
EditValue = EditValue - Step;
- } else {
+ } else if (EditValue > Minimum){
EditValue = Minimum;
+ } else {
+ EditValue = Maximum;
}
} else if (Key.ScanCode == SCAN_RIGHT) {
- EditValue = EditValue + Step;
- if (EditValue > Maximum) {
+ if (EditValue + Step <= Maximum) {
+ EditValue = EditValue + Step;
+ } else if (EditValue < Maximum) {
EditValue = Maximum;
+ } else {
+ EditValue = Minimum;
}
}