0.6.1 (12/??/2012):
-------------------
+- Refined hints displays to be more context-sensitive, particularly in text
+ mode.
+
- Instead of displaying a blank filesystem label when a filesystem has
- none, rEFInd now displays the size of the filesystem, as in "boot
- EFI\foo\bar.efi from 200 MiB volume" rather than "boot EFI\foo\bar.efi
- from". For some filesystems, the filesystem type is included, as in "boot
- EFI\foo\bar.efi from 200 MiB ext3 volume".
+ none, rEFInd now displays the size and/or type of the filesystem, as in
+ "boot EFI\foo\bar.efi from 200 MiB ext3 volume" rather than "boot
+ EFI\foo\bar.efi from".
- Fixed a bug that caused the screen to clear after displaying an error
message but before displaying the "Hit any key to continue" message when
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * Modifications copyright (c) 2012 Roderick W. Smith
+ *
+ * Modifications distributed under the terms of the GNU General Public
+ * License (GPL) version 3 (GPLv3), a copy of which must be distributed
+ * with this source code or binaries made from it.
+ *
+ */
#include "libegint.h"
#include "../refind/screen.h"
UINTN i, c;
// clip the text
- TextLength = StrLen(Text);
+ if (Text)
+ TextLength = StrLen(Text);
+ else
+ TextLength = 0;
+
if (TextLength * FONT_CELL_WIDTH + PosX > CompImage->Width)
TextLength = (CompImage->Width - PosX) / FONT_CELL_WIDTH;
*/
/*
* Modifications copyright (c) 2012 Roderick W. Smith
- *
+ *
* Modifications distributed under the terms of the GNU General Public
* License (GPL) version 3 (GPLv3), a copy of which must be distributed
* with this source code or binaries made from it.
- *
+ *
*/
#ifndef __GLOBAL_H_
REFIT_MENU_ENTRY **Entries;
UINTN TimeoutSeconds;
CHAR16 *TimeoutText;
+ CHAR16 *Hint1;
+ CHAR16 *Hint2;
} REFIT_MENU_SCREEN;
typedef struct {
CHAR16 *SISize, *TypeName;
FileSystemInfoPtr = LibFileSystemInfo(Volume->RootDir);
- if (FileSystemInfoPtr != NULL) {
+ if (FileSystemInfoPtr != NULL) { // we have filesystem information (size, label)....
if ((FileSystemInfoPtr->VolumeLabel != NULL) && (StrLen(FileSystemInfoPtr->VolumeLabel) > 0)) {
FoundName = StrDuplicate(FileSystemInfoPtr->VolumeLabel);
}
FoundName = NULL;
} // if rEFInd HFS+ driver suspected
- if (FoundName == NULL) { // filesystem has no name....
+ if (FoundName == NULL) { // filesystem has no name, so use fs type and size
FoundName = AllocateZeroPool(sizeof(CHAR16) * 256);
if (FoundName != NULL) {
SISize = SizeInIEEEUnits(FileSystemInfoPtr->VolumeSize);
FreePool(FileSystemInfoPtr);
- } else {
+ } else { // fs driver not returning info; fall back on our own information....
FoundName = AllocateZeroPool(sizeof(CHAR16) * 256);
if (FoundName != NULL) {
- TypeName = FSTypeName(Volume->FSType); // NOTE: Don't free TypeName; fn returns constant
+ TypeName = FSTypeName(Volume->FSType); // NOTE: Don't free TypeName; function returns constant
if (StrLen(TypeName) > 0)
SPrint(FoundName, 255, L"%s volume", FSTypeName(Volume->FSType));
else
*/
/*
* Modifications copyright (c) 2012 Roderick W. Smith
- *
+ *
* Modifications distributed under the terms of the GNU General Public
* License (GPL) version 3 (GPLv3), a copy of which must be distributed
* with this source code or binaries made from it.
- *
+ *
*/
#ifndef __LIB_H_
// a ".efi" extension to be found when scanning for boot loaders.
#define LINUX_MATCH_PATTERNS L"vmlinuz*,bzImage*"
+// Default hint text
+#define SUBSCREEN_HINT1 L"Use arrow keys to move cursor; Enter to boot;"
+#define SUBSCREEN_HINT2 L"Insert or F2 to edit options; Esc to return to main menu"
+#define SUBSCREEN_HINT2_NO_EDITOR L"Esc to return to main menu"
+
static REFIT_MENU_ENTRY MenuEntryAbout = { L"About rEFInd", TAG_ABOUT, 1, 0, 'A', NULL, NULL, NULL };
static REFIT_MENU_ENTRY MenuEntryReset = { L"Reboot Computer", TAG_REBOOT, 1, 0, 'R', NULL, NULL, NULL };
static REFIT_MENU_ENTRY MenuEntryShutdown = { L"Shut Down Computer", TAG_SHUTDOWN, 1, 0, 'U', NULL, NULL, NULL };
static REFIT_MENU_ENTRY MenuEntryReturn = { L"Return to Main Menu", TAG_RETURN, 0, 0, 0, NULL, NULL, NULL };
static REFIT_MENU_ENTRY MenuEntryExit = { L"Exit rEFInd", TAG_EXIT, 1, 0, 0, NULL, NULL, NULL };
-static REFIT_MENU_SCREEN MainMenu = { L"Main Menu", NULL, 0, NULL, 0, NULL, 0, L"Automatic boot" };
-static REFIT_MENU_SCREEN AboutMenu = { L"About", NULL, 0, NULL, 0, NULL, 0, NULL };
+static REFIT_MENU_SCREEN MainMenu = { L"Main Menu", NULL, 0, NULL, 0, NULL, 0, L"Automatic boot",
+ L"Use arrow keys to move cursor; Enter to boot;",
+ L"Insert or F2 for more options; Esc to refresh" };
+static REFIT_MENU_SCREEN AboutMenu = { L"About", NULL, 0, NULL, 0, NULL, 0, NULL, L"Press Enter to return to main menu", L"" };
REFIT_CONFIG GlobalConfig = { FALSE, FALSE, 0, 0, 0, 20, 0, 0, GRAPHICS_FOR_OSX, LEGACY_TYPE_MAC, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
for (i = 0; i < Entry->EntryCount && NewEntry->Entries; i++) {
AddMenuEntry(NewEntry, Entry->Entries[i]);
} // for
+ NewEntry->Hint1 = (Entry->Hint1) ? StrDuplicate(Entry->Hint1) : NULL;
+ NewEntry->Hint2 = (Entry->Hint2) ? StrDuplicate(Entry->Hint2) : NULL;
} // if
return (NewEntry);
} // static REFIT_MENU_SCREEN* CopyMenuScreen()
MyFreePool(MainOptions);
AddMenuEntry(SubScreen, (REFIT_MENU_ENTRY *)SubEntry);
} // if (SubEntry != NULL)
+ SubScreen->Hint1 = StrDuplicate(SUBSCREEN_HINT1);
+ if (GlobalConfig.HideUIFlags & HIDEUI_FLAG_EDITOR) {
+ SubScreen->Hint2 = StrDuplicate(SUBSCREEN_HINT2_NO_EDITOR);
+ } else {
+ SubScreen->Hint2 = StrDuplicate(SUBSCREEN_HINT2);
+ } // if/else
} // if (SubScreen != NULL)
} else { // existing subscreen; less initialization, and just add new entry later....
SubScreen = Entry->me.SubScreen;
SubScreen->Title = AllocateZeroPool(256 * sizeof(CHAR16));
SPrint(SubScreen->Title, 255, L"Boot Options for %s on %s", LoaderTitle, VolDesc);
SubScreen->TitleImage = Entry->me.Image;
+ SubScreen->Hint1 = StrDuplicate(SUBSCREEN_HINT1);
+ if (GlobalConfig.HideUIFlags & HIDEUI_FLAG_EDITOR) {
+ SubScreen->Hint2 = StrDuplicate(SUBSCREEN_HINT2_NO_EDITOR);
+ } else {
+ SubScreen->Hint2 = StrDuplicate(SUBSCREEN_HINT2);
+ } // if/else
// default entry
SubEntry = AllocateZeroPool(sizeof(LEGACY_ENTRY));
SubScreen->Title = AllocateZeroPool(256 * sizeof(CHAR16));
SPrint(SubScreen->Title, 255, L"No boot options for legacy target");
SubScreen->TitleImage = Entry->me.Image;
+ SubScreen->Hint1 = StrDuplicate(SUBSCREEN_HINT1);
+ if (GlobalConfig.HideUIFlags & HIDEUI_FLAG_EDITOR) {
+ SubScreen->Hint2 = StrDuplicate(SUBSCREEN_HINT2_NO_EDITOR);
+ } else {
+ SubScreen->Hint2 = StrDuplicate(SUBSCREEN_HINT2);
+ } // if/else
// default entry
SubEntry = AllocateZeroPool(sizeof(LEGACY_ENTRY));
*/
/*
* Modifications copyright (c) 2012 Roderick W. Smith
- *
+ *
* Modifications distributed under the terms of the GNU General Public
* License (GPL) version 3 (GPLv3), a copy of which must be distributed
* with this source code or binaries made from it.
- *
+ *
*/
#include "global.h"
MenuPosY = 4;
if (Screen->InfoLineCount > 0)
MenuPosY += Screen->InfoLineCount + 1;
- MenuHeight = ConHeight - MenuPosY - 2;
+ MenuHeight = ConHeight - MenuPosY - 3;
if (Screen->TimeoutSeconds > 0)
MenuHeight -= 2;
InitScroll(State, Screen->EntryCount, MenuHeight);
else
refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, L" ");
if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) {
- refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 0, ConHeight - 1);
- refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut,
- L"Use arrow keys to move cursor; Enter to boot; Insert or F2 for more options");
+ if (Screen->Hint1 != NULL) {
+ refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 0, ConHeight - 2);
+ refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, Screen->Hint1);
+ }
+ if (Screen->Hint2 != NULL) {
+ refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 0, ConHeight - 1);
+ refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, Screen->Hint2);
+ }
}
break;
if (ParamText[0] == 0) {
// clear message
refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_BASIC);
- refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 0, ConHeight - 2);
+ refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 0, ConHeight - 3);
refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, BlankLine + 1);
} else {
// paint or update message
refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_ERROR);
- refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 3, ConHeight - 2);
+ refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 3, ConHeight - 3);
SPrint(TimeoutMessage, 255, L"%s ", ParamText);
refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, TimeoutMessage);
}
EntriesPosX, EntriesPosY + i * TEXT_LINE_HEIGHT);
}
if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) {
- if (GlobalConfig.HideUIFlags & HIDEUI_FLAG_EDITOR) {
- DrawMenuText(L"Use arrow keys to move cursor; Enter to boot", 0,
- (UGAWidth - (45 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3));
- } else {
- DrawMenuText(L"Use arrow keys to move cursor; Enter to boot;", 0,
- (UGAWidth - (45 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3));
- DrawMenuText(L"Insert or F2 to edit options; Esc to return to main menu", 0,
- (UGAWidth - (56 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2));
- } // if/else
+ if ((Screen->Hint1 != NULL) && (StrLen(Screen->Hint1) > 0)) {
+ DrawMenuText(Screen->Hint1, 0, (UGAWidth - (StrLen(Screen->Hint1) * FONT_CELL_WIDTH)) / 2,
+ UGAHeight - (FONT_CELL_HEIGHT * 3));
+ }
+ if ((Screen->Hint2 != NULL) && (StrLen(Screen->Hint2) > 0)) {
+ DrawMenuText(Screen->Hint2, 0, (UGAWidth - (StrLen(Screen->Hint2) * FONT_CELL_WIDTH)) / 2,
+ UGAHeight - (FONT_CELL_HEIGHT * 2));
+ } // if
} // if
break;
(UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY);
if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) {
- DrawMainMenuText(L"Use arrow keys to move cursor; Enter to boot;",
- (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3));
- DrawMainMenuText(L"Insert or F2 for more options; Esc to refresh",
- (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2));
+ DrawMainMenuText(Screen->Hint1, (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3));
+ DrawMainMenuText(Screen->Hint2, (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2));
} // if
} // static VOID PaintAll()
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * Modifications copyright (c) 2012 Roderick W. Smith
+ *
+ * Modifications distributed under the terms of the GNU General Public
+ * License (GPL) version 3 (GPLv3), a copy of which must be distributed
+ * with this source code or binaries made from it.
+ *
+ */
#include "global.h"
#include "screen.h"