Compare commits

...

6 commits

Author SHA1 Message Date
y4my4my4m
fa14680097
Merge 9b82ba8278 into e34e75626f 2024-12-23 09:48:39 +09:00
Gunch
e34e75626f
Merge pull request #166 from mknos/kdisplay_dowhile
Some checks failed
Build ZealOS ISOs / Build (push) Has been cancelled
convert tab case in RawPutChar() to do-while loop
2024-12-19 23:05:40 -05:00
Michael Mikonos
dba0d17880 revert permission 2024-12-19 10:31:58 +08:00
Michael Mikonos
742b2fad72 tab case in RawPutChar() can also be converted to do-while 2024-12-19 10:30:58 +08:00
Arsenic Blood
9b82ba8278
Merge branch 'master' into fontbook 2024-03-11 03:31:02 -04:00
y4my4my4m
48ea59e96f fontbook 2023-11-18 20:48:22 -05:00
3 changed files with 77 additions and 2 deletions

BIN
src/Home/FontBook/CurrentFont.TXT Executable file

Binary file not shown.

75
src/Home/FontBook/FontCycle.ZC Executable file
View file

@ -0,0 +1,75 @@
U0 FontCycle(I8 direction)
{
CDirEntry *tmpde1, *previous = NULL, *selected = NULL;
U8 selected_font;
I64 current_font = FileRead("~/FontBook/CurrentFont.TXT");
if (!current_font)
{
FileWrite("~/FontBook/CurrentFont.TXT", "Zeal", 4);
}
//I64 current_font = "Zeal";
//"$$LTBLUE$$current_font:\t%s$$FG$$\n", current_font;
if (direction == 0)
{
selected_font = current_font;
goto load_current;
}
tmpde1 = FilesFind("~/FontBook/Fonts/*.BIN", 1);
if (!tmpde1) return;
do {
FileExtRemove(tmpde1->name);
//"found:\t\t\t%s\n", tmpde1->name;
// Check if this is the current font
if (StrCompare(current_font, tmpde1->name) == 0) {
if (direction == 1) {
if (tmpde1->next) {
selected = tmpde1->next;
} else {
selected = FilesFind("~/FontBook/Fonts/*.BIN", 1); // Start from the first font if at the end
}
} else {
if (previous) {
selected = previous;
} else {
// Find the last font for the case where direction is -1 and we're at the start
CDirEntry *temp = tmpde1;
while (temp->next) {
temp = temp->next;
}
selected = temp;
}
}
break; // Exit loop once the current font is found.
}
previous = tmpde1;
tmpde1 = tmpde1->next;
} while (tmpde1);
if (selected) {
FileExtRemove(selected->name);
selected_font = selected->name;
"\n$$YELLOW$$selected:\t\t%s$$FG$$\n", selected_font;
FileWrite("~/FontBook/CurrentFont.TXT", selected_font, StrLen(selected_font)+1);
load_current:
U8 selected_path[0];
StrPrint(selected_path, "~/FontBook/Fonts/%s.BIN", selected_font);
//"%s\n", selected_path;
U64 *new_font = FileRead(selected_path);
if (new_font) {
text.font = new_font;
Free(new_font);
}
}
}
//FontCycle(1);

View file

@ -35,9 +35,9 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
} }
if (ch == '\t') if (ch == '\t')
{ {
do
RawPutChar(CH_SPACE); RawPutChar(CH_SPACE);
while (text.raw_col & 3) while (text.raw_col & 3);
RawPutChar(CH_SPACE);
} }
else if (ch == CH_BACKSPACE) else if (ch == CH_BACKSPACE)
{ {