more files reformatted.

This commit is contained in:
TomAwezome 2020-04-22 03:16:08 -04:00
parent 32f5753c1a
commit f9dd08e10e
5 changed files with 858 additions and 665 deletions

View file

@ -1,5 +1,8 @@
$WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$
$IV,1$----04/21/20 18:54:47----$IV,0$
$IV,1$----04/22/20 03:09:47----$IV,0$
* More files reformatted. $LK+PU,"Menu",A="FI:::/Zenith/Menu.CC"$, $LK+PU,"Window Manager",A="FI:::/Zenith/WinMgr.CC"$.$IV,1$
----04/21/20 18:54:47----$IV,0$
* Altered $LK+PU,"Tom Palettes",A="FF:::/Zenith/Gr/GrPalette.CC,PaletteSetTom"$ for better visibility.$IV,1$
----04/21/20 16:13:01----$IV,0$

View file

@ -1,19 +1,22 @@
$FG,7$Files reformatted starting from ::/ 'root' directory.$FG,0$
StartOS.CC
Once.CC
HomeWrappers.CC
HomeSys.CC
HomeLocalize.CC
HomeKeyPlugins.CC
HomeLocalize.CC
HomeSys.CC
HomeWrappers.CC
Once.CC
StartOS.CC
/Zenith/
DevInfo.CC
InFile.CC
MakeZenith.CC
Menu.CC
TaskSettings.CC
Training.CC
WallPaper.CC
Win.CC
WinMgr.CC
$FG,7$-Tom$FG,0$

View file

@ -11,10 +11,10 @@ CTask *MenuTask()
CMenuEntry *sys_cur_submenu_entry = NULL;
public CMenuEntry *MenuSubEntryFind(
CMenuEntry *haystack_first,U8 *needle_entry_name)
public CMenuEntry *MenuSubEntryFind(CMenuEntry *haystack_first, U8 *needle_entry_name)
{//You probably don't need this. Use dir / and $LK,"MenuEntryFind",A="MN:MenuEntryFind"$().
while (haystack_first) {
while (haystack_first)
{
if (!StrCompare(haystack_first->name, needle_entry_name))
return haystack_first;
haystack_first = haystack_first->next;
@ -32,7 +32,8 @@ public CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name)
st = StrNew(needle_full_name);
st2 = StrNew(needle_full_name);
tmpse = (&haystack_menu->sub)(U8 *) - offset(CMenuEntry.sub);
while (*st && tmpse) {
while (*st && tmpse)
{
StrFirstRemove(st, "/", st2);
tmpse=MenuSubEntryFind(tmpse->sub, st2);
}
@ -44,12 +45,14 @@ public CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name)
CMenuEntry *MenuNewSub(CCompCtrl *cc, CTask *task)
{
CMenuEntry *tmpme = NULL, *tmpse;
if (cc->token==TK_IDENT) {
if (cc->token==TK_IDENT)
{
tmpme = CAlloc(sizeof(CMenuEntry),task);
if (StrLen(cc->cur_str) > 31)
cc->cur_str[31] = 0;
StrCopy(tmpme->name, cc->cur_str);
if (Lex(cc)=='(') {
if (Lex(cc) == '(')
{
tmpme->message_code = MESSAGE_KEY_DOWN_UP;
if (Lex(cc) != ',' && cc->token != ')')
tmpme->message_code = LexExpressionI64(cc);
@ -66,7 +69,9 @@ CMenuEntry *MenuNewSub(CCompCtrl *cc,CTask *task)
if (Lex(cc) != ';')
LexExcept(cc, "Missing ';' at");
Lex(cc); //Skip ;
} else if (cc->token=='{') {
}
else if (cc->token == '{')
{
Lex(cc); //Skip {
tmpme->dir = TRUE;
tmpse = &tmpme->sub;
@ -76,7 +81,8 @@ CMenuEntry *MenuNewSub(CCompCtrl *cc,CTask *task)
LexExcept(cc, "Missing '}' at ");
else
Lex(cc); //Skip }
} else
}
else
LexExcept(cc, "Expecting '{' at ");
}
return tmpme;
@ -112,9 +118,11 @@ public CMenu *MenuFile(U8 *filename,I64 flags=0,CTask *task=NULL)
U0 MenuDelSub(CMenuEntry *tmpme)
{
CMenuEntry *tmpse, *tmpse1;
if (tmpme) {
if (tmpme)
{
tmpse = tmpme->sub;
while (tmpse) {
while (tmpse)
{
tmpse1 = tmpse->next;
MenuDelSub(tmpse);
tmpse = tmpse1;
@ -128,7 +136,8 @@ public U0 MenuDel(CMenu *m)
CMenuEntry *tmpme, *tmpme1;
if (!m) return;
tmpme = m->sub;
while (tmpme) {
while (tmpme)
{
tmpme1 = tmpme->next;
MenuDelSub(tmpme);
tmpme = tmpme1;
@ -140,7 +149,8 @@ I64 MenuEntryWidth(CMenuEntry *tmpme)
{
I64 res = StrLen(tmpme->name);
CMenuEntry *tmpse = tmpme->sub;
while (tmpse) {
while (tmpse)
{
res = MaxI64(res, StrLen(tmpse->name));
tmpse = tmpse->next;
}
@ -178,7 +188,8 @@ U0 DrawMenu(CDC *dc)
U8 *st = NULL;
CTask *task = MenuTask;
I64 i, w, x0, y0, x1 = mouse.pos.x, y1 = mouse.pos.y;
if (!TaskValidate(task) || !(m=task->cur_menu)) {
if (!TaskValidate(task) || !(m = task->cur_menu))
{
sys_cur_submenu_entry = NULL;
return;
}
@ -186,26 +197,32 @@ U0 DrawMenu(CDC *dc)
GrRect(dc, 0, 0, GR_WIDTH, FONT_HEIGHT);
x0 = 0;
tmpme = m->sub;
while (tmpme) {
while (tmpme)
{
w = MenuEntryWidth(tmpme) * FONT_WIDTH;
if (x0 <= x1 < x0 + w) {
if (0<=y1<FONT_HEIGHT) {
if (0 <= y1 < FONT_HEIGHT)
{
dc->color = m->attr & 15;
GrRect(dc, x0, 0, w, FONT_HEIGHT);
dc->color = m->attr >> 4;
} else
}
else
dc->color = m->attr & 15;
GrPrint(dc, x0, 0, "%s", tmpme->name);
y0 = FONT_HEIGHT;
tmpse = tmpme->sub;
while (tmpse) {
while (tmpse)
{
if (tmpse->checked)
i = m->attr ^ 0xFF;
else
i = m->attr;
if (y0<=y1<y0+FONT_HEIGHT) {
if (y0 <= y1 < y0 + FONT_HEIGHT)
{
if (tmpse->message_code == MESSAGE_KEY_DOWN ||
tmpse->message_code==MESSAGE_KEY_DOWN_UP) {
tmpse->message_code == MESSAGE_KEY_DOWN_UP)
{
if (!tmpse->arg2)
tmpse->arg2 = Char2ScanCode(tmpse->arg1);
st = ScanCode2KeyName(tmpse->arg2);
@ -215,7 +232,8 @@ U0 DrawMenu(CDC *dc)
GrRect(dc, x0, y0, w, FONT_HEIGHT);
dc->color = i >> 4;
GrPrint(dc, x0, y0, "%s", tmpse->name);
if (st) {
if (st)
{
dc->color = i >> 4;
GrRect(dc, x0 + w, y0 - FONT_HEIGHT,
(StrLen(st) + 1) * FONT_WIDTH, FONT_HEIGHT * 3);
@ -223,7 +241,9 @@ U0 DrawMenu(CDC *dc)
GrPrint(dc, x0 + w, y0, "%s", st);
Free(st);
}
} else {
}
else
{
dc->color = i >> 4;
GrRect(dc, x0, y0, w, FONT_HEIGHT);
dc->color = i & 15;
@ -232,7 +252,9 @@ U0 DrawMenu(CDC *dc)
y0 += FONT_HEIGHT;
tmpse = tmpse->next;
}
} else {
}
else
{
dc->color = m->attr & 15;
GrPrint(dc, x0, 0, "%s", tmpme->name);
}

File diff suppressed because it is too large Load diff