mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
- Made the partition list movable if it is necessary.
svn path=/trunk/; revision=10635
This commit is contained in:
parent
0ebfb773cb
commit
9995491445
2 changed files with 172 additions and 58 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: partlist.c,v 1.27 2004/08/15 22:29:50 chorns Exp $
|
||||
/* $Id: partlist.c,v 1.28 2004/08/21 19:30:12 hbirr Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/partlist.c
|
||||
|
@ -719,24 +719,24 @@ PrintEmptyLine (PPARTLIST List)
|
|||
USHORT Height;
|
||||
|
||||
Width = List->Right - List->Left - 1;
|
||||
Height = List->Bottom - List->Top - 1;
|
||||
Height = List->Bottom - List->Top - 2;
|
||||
|
||||
if (List->Line < 0 || List->Line > Height)
|
||||
return;
|
||||
|
||||
coPos.X = List->Left + 1;
|
||||
coPos.Y = List->Top + 1 + List->Line;
|
||||
|
||||
FillConsoleOutputAttribute (0x17,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
FillConsoleOutputCharacter (' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
if (List->Line >= 0 && List->Line <= Height)
|
||||
{
|
||||
FillConsoleOutputAttribute (0x17,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
FillConsoleOutputCharacter (' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
List->Line++;
|
||||
}
|
||||
|
||||
|
@ -758,10 +758,8 @@ PrintPartitionData (PPARTLIST List,
|
|||
PCHAR PartType;
|
||||
|
||||
Width = List->Right - List->Left - 1;
|
||||
Height = List->Bottom - List->Top - 1;
|
||||
Height = List->Bottom - List->Top - 2;
|
||||
|
||||
if (List->Line < 0 || List->Line > Height)
|
||||
return;
|
||||
|
||||
coPos.X = List->Left + 1;
|
||||
coPos.Y = List->Top + 1 + List->Line;
|
||||
|
@ -864,24 +862,30 @@ PrintPartitionData (PPARTLIST List,
|
|||
Attribute = (List->CurrentDisk == DiskEntry &&
|
||||
List->CurrentPartition == PartEntry) ? 0x71 : 0x17;
|
||||
|
||||
FillConsoleOutputCharacter (' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
if (List->Line >= 0 && List->Line <= Height)
|
||||
{
|
||||
FillConsoleOutputCharacter (' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
coPos.X += 4;
|
||||
Width -= 8;
|
||||
FillConsoleOutputAttribute (Attribute,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
if (List->Line >= 0 && List->Line <= Height)
|
||||
{
|
||||
FillConsoleOutputAttribute (Attribute,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
coPos.X++;
|
||||
Width -= 2;
|
||||
WriteConsoleOutputCharacters (LineBuffer,
|
||||
min (strlen (LineBuffer), Width),
|
||||
coPos);
|
||||
|
||||
if (List->Line >= 0 && List->Line <= Height)
|
||||
{
|
||||
WriteConsoleOutputCharacters (LineBuffer,
|
||||
min (strlen (LineBuffer), Width),
|
||||
coPos);
|
||||
}
|
||||
List->Line++;
|
||||
}
|
||||
|
||||
|
@ -901,10 +905,8 @@ PrintDiskData (PPARTLIST List,
|
|||
PCHAR Unit;
|
||||
|
||||
Width = List->Right - List->Left - 1;
|
||||
Height = List->Bottom - List->Top - 1;
|
||||
Height = List->Bottom - List->Top - 2;
|
||||
|
||||
if (List->Line < 0 || List->Line > Height)
|
||||
return;
|
||||
|
||||
coPos.X = List->Left + 1;
|
||||
coPos.Y = List->Top + 1 + List->Line;
|
||||
|
@ -947,22 +949,26 @@ PrintDiskData (PPARTLIST List,
|
|||
DiskEntry->Bus,
|
||||
DiskEntry->Id);
|
||||
}
|
||||
|
||||
FillConsoleOutputAttribute (0x17,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
FillConsoleOutputCharacter (' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
if (List->Line >= 0 && List->Line <= Height)
|
||||
{
|
||||
FillConsoleOutputAttribute (0x17,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
FillConsoleOutputCharacter (' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
|
||||
coPos.X++;
|
||||
WriteConsoleOutputCharacters (LineBuffer,
|
||||
min (strlen (LineBuffer), Width - 2),
|
||||
coPos);
|
||||
|
||||
if (List->Line >= 0 && List->Line <= Height)
|
||||
{
|
||||
WriteConsoleOutputCharacters (LineBuffer,
|
||||
min (strlen (LineBuffer), Width - 2),
|
||||
coPos);
|
||||
}
|
||||
List->Line++;
|
||||
|
||||
/* Print separator line */
|
||||
|
@ -990,11 +996,80 @@ PrintDiskData (PPARTLIST List,
|
|||
VOID
|
||||
DrawPartitionList (PPARTLIST List)
|
||||
{
|
||||
PLIST_ENTRY Entry;
|
||||
PLIST_ENTRY Entry, Entry2;
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry = NULL;
|
||||
COORD coPos;
|
||||
ULONG Written;
|
||||
SHORT i;
|
||||
SHORT CurrentDiskLine;
|
||||
SHORT CurrentPartLine;
|
||||
SHORT LastLine;
|
||||
BOOL CurrentPartLineFound = FALSE;
|
||||
BOOL CurrentDiskLineFound = FALSE;
|
||||
|
||||
/* Calculate the line of the current disk and partition */
|
||||
CurrentDiskLine = 0;
|
||||
CurrentPartLine = 0;
|
||||
LastLine = 0;
|
||||
Entry = List->DiskListHead.Flink;
|
||||
while (Entry != &List->DiskListHead)
|
||||
{
|
||||
DiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
|
||||
LastLine += 2;
|
||||
if (CurrentPartLineFound == FALSE)
|
||||
{
|
||||
CurrentPartLine += 2;
|
||||
}
|
||||
Entry2 = DiskEntry->PartListHead.Flink;
|
||||
while (Entry2 != &DiskEntry->PartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry);
|
||||
if (PartEntry == List->CurrentPartition)
|
||||
{
|
||||
CurrentPartLineFound = TRUE;;
|
||||
}
|
||||
Entry2 = Entry2->Flink;
|
||||
if (CurrentPartLineFound == FALSE)
|
||||
{
|
||||
CurrentPartLine++;
|
||||
}
|
||||
LastLine++;
|
||||
}
|
||||
if (DiskEntry == List->CurrentDisk)
|
||||
{
|
||||
CurrentDiskLineFound = TRUE;
|
||||
}
|
||||
Entry = Entry->Flink;
|
||||
if (Entry != &List->DiskListHead)
|
||||
{
|
||||
if (CurrentDiskLineFound == FALSE)
|
||||
{
|
||||
CurrentPartLine ++;
|
||||
CurrentDiskLine = CurrentPartLine;
|
||||
}
|
||||
LastLine++;
|
||||
}
|
||||
else
|
||||
{
|
||||
LastLine--;
|
||||
}
|
||||
}
|
||||
|
||||
/* If it possible, make the disk name visible */
|
||||
if (CurrentPartLine < List->Offset)
|
||||
{
|
||||
List->Offset = CurrentPartLine;
|
||||
}
|
||||
else if (CurrentPartLine - List->Offset > List->Bottom - List->Top - 2)
|
||||
{
|
||||
List->Offset = CurrentPartLine - (List->Bottom - List->Top - 2);
|
||||
}
|
||||
if (CurrentDiskLine < List->Offset && CurrentPartLine - CurrentDiskLine < List->Bottom - List->Top - 2)
|
||||
{
|
||||
List->Offset = CurrentDiskLine;
|
||||
}
|
||||
|
||||
|
||||
/* draw upper left corner */
|
||||
coPos.X = List->Left;
|
||||
|
@ -1007,10 +1082,29 @@ DrawPartitionList (PPARTLIST List)
|
|||
/* draw upper edge */
|
||||
coPos.X = List->Left + 1;
|
||||
coPos.Y = List->Top;
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
List->Right - List->Left - 1,
|
||||
coPos,
|
||||
&Written);
|
||||
if (List->Offset == 0)
|
||||
{
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
List->Right - List->Left - 1,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
List->Right - List->Left - 5,
|
||||
coPos,
|
||||
&Written);
|
||||
coPos.X = List->Right - 5;
|
||||
WriteConsoleOutputCharacters ("(\x18)", // "(up)"
|
||||
3,
|
||||
coPos);
|
||||
coPos.X = List->Right - 2;
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
2,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
|
||||
/* draw upper right corner */
|
||||
coPos.X = List->Right;
|
||||
|
@ -1048,10 +1142,29 @@ DrawPartitionList (PPARTLIST List)
|
|||
/* draw lower edge */
|
||||
coPos.X = List->Left + 1;
|
||||
coPos.Y = List->Bottom;
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
List->Right - List->Left - 1,
|
||||
coPos,
|
||||
&Written);
|
||||
if (LastLine - List->Offset <= List->Bottom - List->Top - 2)
|
||||
{
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
List->Right - List->Left - 1,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
List->Right - List->Left - 5,
|
||||
coPos,
|
||||
&Written);
|
||||
coPos.X = List->Right - 5;
|
||||
WriteConsoleOutputCharacters ("(\x19)", // "(down)"
|
||||
3,
|
||||
coPos);
|
||||
coPos.X = List->Right - 2;
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
2,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
|
||||
/* draw lower right corner */
|
||||
coPos.X = List->Right;
|
||||
|
@ -1062,7 +1175,7 @@ DrawPartitionList (PPARTLIST List)
|
|||
&Written);
|
||||
|
||||
/* print list entries */
|
||||
List->Line = 0;
|
||||
List->Line = - List->Offset;
|
||||
|
||||
Entry = List->DiskListHead.Flink;
|
||||
while (Entry != &List->DiskListHead)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: partlist.h,v 1.22 2003/10/06 19:22:42 chorns Exp $
|
||||
/* $Id: partlist.h,v 1.23 2004/08/21 19:30:12 hbirr Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/partlist.h
|
||||
|
@ -106,6 +106,7 @@ typedef struct _PARTLIST
|
|||
SHORT Bottom;
|
||||
|
||||
SHORT Line;
|
||||
SHORT Offset;
|
||||
|
||||
ULONG TopDisk;
|
||||
ULONG TopPartition;
|
||||
|
|
Loading…
Reference in a new issue