Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 1999 Intel Corporation
  3. Module Name:
  4. libTitle.c
  5. --*/
  6. #ifndef _LIB_TITLE_BAR
  7. #define _LIB_TITLE_BAR
  8. #include "editor.h"
  9. STATIC EFI_STATUS MainTitleBarInit (VOID);
  10. STATIC EFI_STATUS MainTitleBarCleanup (VOID);
  11. STATIC EFI_STATUS MainTitleBarRefresh (VOID);
  12. STATIC EFI_STATUS MainTitleBarHide (VOID);
  13. STATIC EFI_STATUS MainTitleBarSetTitle (CHAR16*);
  14. EFI_EDITOR_TITLE_BAR MainTitleBar = {
  15. NULL,
  16. MainTitleBarInit,
  17. MainTitleBarCleanup,
  18. MainTitleBarRefresh,
  19. MainTitleBarHide,
  20. MainTitleBarSetTitle
  21. };
  22. EFI_EDITOR_TITLE_BAR MainTitleBarConst = {
  23. NULL,
  24. MainTitleBarInit,
  25. MainTitleBarCleanup,
  26. MainTitleBarRefresh,
  27. MainTitleBarHide,
  28. MainTitleBarSetTitle
  29. };
  30. STATIC
  31. EFI_STATUS
  32. MainTitleBarInit (
  33. VOID
  34. )
  35. {
  36. CopyMem (&MainTitleBar, &MainTitleBarConst, sizeof(MainTitleBar));
  37. MainTitleBar.SetTitleString(L"New File");
  38. return EFI_SUCCESS;
  39. }
  40. STATIC
  41. EFI_STATUS
  42. MainTitleBarCleanup (
  43. VOID
  44. )
  45. {
  46. MainEditor.FileBuffer->ClearLine (TITLE_BAR_LOCATION);
  47. return EFI_SUCCESS;
  48. }
  49. STATIC
  50. EFI_STATUS
  51. MainTitleBarRefresh (
  52. VOID
  53. )
  54. {
  55. EFI_EDITOR_COLOR_UNION Orig,New;
  56. Orig = MainEditor.ColorAttributes;
  57. New.Colors.Foreground = Orig.Colors.Background;
  58. New.Colors.Background = Orig.Colors.Foreground;
  59. Out->SetAttribute (Out,New.Data);
  60. MainEditor.FileBuffer->ClearLine (TITLE_BAR_LOCATION);
  61. PrintAt (0,TITLE_BAR_LOCATION,L" %s %s %s ",EDITOR_NAME,EDITOR_VERSION,MainTitleBar.Filename);
  62. if (MainEditor.FileImage->FileType == ASCII_FILE) {
  63. Print(L"[ASCII]");
  64. } else {
  65. Print(L"[UNICODE]");
  66. }
  67. if (MainEditor.FileModified) {
  68. Print(L" Modified");
  69. }
  70. Out->SetAttribute (Out,Orig.Data);
  71. MainEditor.FileBuffer->RestorePosition();
  72. return EFI_SUCCESS;
  73. }
  74. STATIC
  75. EFI_STATUS
  76. MainTitleBarHide (
  77. VOID
  78. )
  79. {
  80. MainEditor.FileBuffer->ClearLine (TITLE_BAR_LOCATION);
  81. return EFI_SUCCESS;
  82. }
  83. STATIC
  84. EFI_STATUS
  85. MainTitleBarSetTitle (
  86. IN CHAR16 *Filename
  87. )
  88. {
  89. if (MainTitleBar.Filename != NULL ) {
  90. FreePool (MainTitleBar.Filename);
  91. }
  92. MainTitleBar.Filename = StrDuplicate (Filename);
  93. MainTitleBar.Refresh();
  94. return EFI_SUCCESS;
  95. }
  96. #endif /* _LIB_TITLE_BAR */