mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 15:26:43 +00:00
more files reformatted.
This commit is contained in:
parent
32f5753c1a
commit
f9dd08e10e
5 changed files with 858 additions and 665 deletions
Binary file not shown.
|
@ -1,5 +1,8 @@
|
||||||
$WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$
|
$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$
|
* 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$
|
----04/21/20 16:13:01----$IV,0$
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
$FG,7$Files reformatted starting from ::/ 'root' directory.$FG,0$
|
$FG,7$Files reformatted starting from ::/ 'root' directory.$FG,0$
|
||||||
StartOS.CC
|
|
||||||
Once.CC
|
|
||||||
HomeWrappers.CC
|
|
||||||
HomeSys.CC
|
|
||||||
HomeLocalize.CC
|
|
||||||
HomeKeyPlugins.CC
|
HomeKeyPlugins.CC
|
||||||
|
HomeLocalize.CC
|
||||||
|
HomeSys.CC
|
||||||
|
HomeWrappers.CC
|
||||||
|
Once.CC
|
||||||
|
StartOS.CC
|
||||||
|
|
||||||
|
|
||||||
/Zenith/
|
/Zenith/
|
||||||
DevInfo.CC
|
DevInfo.CC
|
||||||
InFile.CC
|
InFile.CC
|
||||||
MakeZenith.CC
|
MakeZenith.CC
|
||||||
|
Menu.CC
|
||||||
TaskSettings.CC
|
TaskSettings.CC
|
||||||
Training.CC
|
Training.CC
|
||||||
WallPaper.CC
|
WallPaper.CC
|
||||||
Win.CC
|
Win.CC
|
||||||
|
WinMgr.CC
|
||||||
|
|
||||||
|
|
||||||
$FG,7$-Tom$FG,0$
|
$FG,7$-Tom$FG,0$
|
|
@ -3,121 +3,129 @@
|
||||||
|
|
||||||
CTask *MenuTask()
|
CTask *MenuTask()
|
||||||
{
|
{
|
||||||
CTask *res=sys_focus_task;
|
CTask *res = sys_focus_task;
|
||||||
while (res && !res->cur_menu)
|
while (res && !res->cur_menu)
|
||||||
res=res->parent_task;
|
res = res->parent_task;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMenuEntry *sys_cur_submenu_entry=NULL;
|
CMenuEntry *sys_cur_submenu_entry = NULL;
|
||||||
|
|
||||||
public CMenuEntry *MenuSubEntryFind(
|
public CMenuEntry *MenuSubEntryFind(CMenuEntry *haystack_first, U8 *needle_entry_name)
|
||||||
CMenuEntry *haystack_first,U8 *needle_entry_name)
|
|
||||||
{//You probably don't need this. Use dir / and $LK,"MenuEntryFind",A="MN:MenuEntryFind"$().
|
{//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))
|
{
|
||||||
|
if (!StrCompare(haystack_first->name, needle_entry_name))
|
||||||
return haystack_first;
|
return haystack_first;
|
||||||
haystack_first=haystack_first->next;
|
haystack_first = haystack_first->next;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name)
|
public CMenuEntry *MenuEntryFind(CMenu *haystack_menu, U8 *needle_full_name)
|
||||||
{//Find pulldown entry. Fs->cur_menu is probably the menu you want.
|
{//Find pulldown entry. Fs->cur_menu is probably the menu you want.
|
||||||
//Just 2 levels -- across top and down are valid, currently.
|
//Just 2 levels -- across top and down are valid, currently.
|
||||||
U8 *st,*st2;
|
U8 *st, *st2;
|
||||||
CMenuEntry *tmpse;
|
CMenuEntry *tmpse;
|
||||||
if (!haystack_menu || !needle_full_name)
|
if (!haystack_menu || !needle_full_name)
|
||||||
return NULL;
|
return NULL;
|
||||||
st=StrNew(needle_full_name);
|
st = StrNew(needle_full_name);
|
||||||
st2=StrNew(needle_full_name);
|
st2 = StrNew(needle_full_name);
|
||||||
tmpse=(&haystack_menu->sub)(U8 *)-offset(CMenuEntry.sub);
|
tmpse = (&haystack_menu->sub)(U8 *) - offset(CMenuEntry.sub);
|
||||||
while (*st && tmpse) {
|
while (*st && tmpse)
|
||||||
StrFirstRemove(st,"/",st2);
|
{
|
||||||
tmpse=MenuSubEntryFind(tmpse->sub,st2);
|
StrFirstRemove(st, "/", st2);
|
||||||
|
tmpse=MenuSubEntryFind(tmpse->sub, st2);
|
||||||
}
|
}
|
||||||
Free(st);
|
Free(st);
|
||||||
Free(st2);
|
Free(st2);
|
||||||
return tmpse;
|
return tmpse;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMenuEntry *MenuNewSub(CCompCtrl *cc,CTask *task)
|
CMenuEntry *MenuNewSub(CCompCtrl *cc, CTask *task)
|
||||||
{
|
{
|
||||||
CMenuEntry *tmpme=NULL,*tmpse;
|
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)
|
tmpme = CAlloc(sizeof(CMenuEntry),task);
|
||||||
cc->cur_str[31]=0;
|
if (StrLen(cc->cur_str) > 31)
|
||||||
StrCopy(tmpme->name,cc->cur_str);
|
cc->cur_str[31] = 0;
|
||||||
if (Lex(cc)=='(') {
|
StrCopy(tmpme->name, cc->cur_str);
|
||||||
tmpme->message_code=MESSAGE_KEY_DOWN_UP;
|
if (Lex(cc) == '(')
|
||||||
if (Lex(cc)!=',' && cc->token!=')')
|
{
|
||||||
tmpme->message_code=LexExpressionI64(cc);
|
tmpme->message_code = MESSAGE_KEY_DOWN_UP;
|
||||||
if (cc->token==',')
|
if (Lex(cc) != ',' && cc->token != ')')
|
||||||
|
tmpme->message_code = LexExpressionI64(cc);
|
||||||
|
if (cc->token == ',')
|
||||||
Lex(cc);
|
Lex(cc);
|
||||||
if (cc->token!=',' && cc->token!=')')
|
if (cc->token != ',' && cc->token != ')')
|
||||||
tmpme->arg1=LexExpressionI64(cc);
|
tmpme->arg1 = LexExpressionI64(cc);
|
||||||
if (cc->token==',')
|
if (cc->token == ',')
|
||||||
Lex(cc);
|
Lex(cc);
|
||||||
if (cc->token!=',' && cc->token!=')')
|
if (cc->token != ',' && cc->token != ')')
|
||||||
tmpme->arg2=LexExpressionI64(cc);
|
tmpme->arg2 = LexExpressionI64(cc);
|
||||||
if (cc->token!=')')
|
if (cc->token != ')')
|
||||||
LexExcept(cc,"Missing ')' at ");
|
LexExcept(cc, "Missing ')' at ");
|
||||||
if (Lex(cc)!=';')
|
if (Lex(cc) != ';')
|
||||||
LexExcept(cc,"Missing ';' at");
|
LexExcept(cc, "Missing ';' at");
|
||||||
Lex(cc); //Skip ;
|
Lex(cc); //Skip ;
|
||||||
} else if (cc->token=='{') {
|
}
|
||||||
|
else if (cc->token == '{')
|
||||||
|
{
|
||||||
Lex(cc); //Skip {
|
Lex(cc); //Skip {
|
||||||
tmpme->dir=TRUE;
|
tmpme->dir = TRUE;
|
||||||
tmpse=&tmpme->sub;
|
tmpse = &tmpme->sub;
|
||||||
while (tmpse && cc->token!='}')
|
while (tmpse && cc->token != '}')
|
||||||
tmpse=tmpse->next=MenuNewSub(cc,task);
|
tmpse = tmpse->next = MenuNewSub(cc, task);
|
||||||
if (cc->token!='}')
|
if (cc->token != '}')
|
||||||
LexExcept(cc,"Missing '}' at ");
|
LexExcept(cc, "Missing '}' at ");
|
||||||
else
|
else
|
||||||
Lex(cc); //Skip }
|
Lex(cc); //Skip }
|
||||||
} else
|
}
|
||||||
LexExcept(cc,"Expecting '{' at ");
|
else
|
||||||
|
LexExcept(cc, "Expecting '{' at ");
|
||||||
}
|
}
|
||||||
return tmpme;
|
return tmpme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CMenu *MenuNew(U8 *st,I64 flags=0,CTask *task=NULL)
|
public CMenu *MenuNew(U8 *st, I64 flags = 0, CTask *task = NULL)
|
||||||
{//Parse a menu. You probably don't need this.
|
{//Parse a menu. You probably don't need this.
|
||||||
CMenu *m;
|
CMenu *m;
|
||||||
CMenuEntry *tmpse;
|
CMenuEntry *tmpse;
|
||||||
CCompCtrl *cc=CompCtrlNew(st,CCF_DONT_FREE_BUF);
|
CCompCtrl *cc = CompCtrlNew(st, CCF_DONT_FREE_BUF);
|
||||||
if (!task) task=Fs;
|
if (!task) task = Fs;
|
||||||
Lex(cc);
|
Lex(cc);
|
||||||
m=CAlloc(sizeof(CMenu),task);
|
m = CAlloc(sizeof(CMenu), task);
|
||||||
m->task=task;
|
m->task = task;
|
||||||
m->flags=flags;
|
m->flags = flags;
|
||||||
m->attr =BLUE<<4+YELLOW;
|
m->attr = BLUE << 4 + YELLOW;
|
||||||
tmpse=&m->sub;
|
tmpse = &m->sub;
|
||||||
while (tmpse)
|
while (tmpse)
|
||||||
tmpse=tmpse->next=MenuNewSub(cc,task);
|
tmpse = tmpse->next = MenuNewSub(cc, task);
|
||||||
CompCtrlDel(cc);
|
CompCtrlDel(cc);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CMenu *MenuFile(U8 *filename,I64 flags=0,CTask *task=NULL)
|
public CMenu *MenuFile(U8 *filename, I64 flags = 0, CTask *task = NULL)
|
||||||
{//Parse a pulldown menu file. You probably don't need this.
|
{//Parse a pulldown menu file. You probably don't need this.
|
||||||
CMenu *m;
|
CMenu *m;
|
||||||
U8 *st=MStrPrint("#include \"%s\"",filename);
|
U8 *st = MStrPrint("#include \"%s\"", filename);
|
||||||
m=MenuNew(st,flags,task);
|
m = MenuNew(st, flags, task);
|
||||||
Free(st);
|
Free(st);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 MenuDelSub(CMenuEntry *tmpme)
|
U0 MenuDelSub(CMenuEntry *tmpme)
|
||||||
{
|
{
|
||||||
CMenuEntry *tmpse,*tmpse1;
|
CMenuEntry *tmpse, *tmpse1;
|
||||||
if (tmpme) {
|
if (tmpme)
|
||||||
tmpse=tmpme->sub;
|
{
|
||||||
while (tmpse) {
|
tmpse = tmpme->sub;
|
||||||
tmpse1=tmpse->next;
|
while (tmpse)
|
||||||
|
{
|
||||||
|
tmpse1 = tmpse->next;
|
||||||
MenuDelSub(tmpse);
|
MenuDelSub(tmpse);
|
||||||
tmpse=tmpse1;
|
tmpse = tmpse1;
|
||||||
}
|
}
|
||||||
Free(tmpme);
|
Free(tmpme);
|
||||||
}
|
}
|
||||||
|
@ -125,119 +133,133 @@ U0 MenuDelSub(CMenuEntry *tmpme)
|
||||||
|
|
||||||
public U0 MenuDel(CMenu *m)
|
public U0 MenuDel(CMenu *m)
|
||||||
{//Delete a manu. You probably don't need this.
|
{//Delete a manu. You probably don't need this.
|
||||||
CMenuEntry *tmpme,*tmpme1;
|
CMenuEntry *tmpme, *tmpme1;
|
||||||
if (!m) return;
|
if (!m) return;
|
||||||
tmpme=m->sub;
|
tmpme = m->sub;
|
||||||
while (tmpme) {
|
while (tmpme)
|
||||||
tmpme1=tmpme->next;
|
{
|
||||||
|
tmpme1 = tmpme->next;
|
||||||
MenuDelSub(tmpme);
|
MenuDelSub(tmpme);
|
||||||
tmpme=tmpme1;
|
tmpme = tmpme1;
|
||||||
}
|
}
|
||||||
Free(m);
|
Free(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 MenuEntryWidth(CMenuEntry *tmpme)
|
I64 MenuEntryWidth(CMenuEntry *tmpme)
|
||||||
{
|
{
|
||||||
I64 res=StrLen(tmpme->name);
|
I64 res = StrLen(tmpme->name);
|
||||||
CMenuEntry *tmpse=tmpme->sub;
|
CMenuEntry *tmpse = tmpme->sub;
|
||||||
while (tmpse) {
|
while (tmpse)
|
||||||
res=MaxI64(res,StrLen(tmpse->name));
|
{
|
||||||
tmpse=tmpse->next;
|
res = MaxI64(res, StrLen(tmpse->name));
|
||||||
|
tmpse = tmpse->next;
|
||||||
}
|
}
|
||||||
return res+1;
|
return res + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CMenu *MenuPush(U8 *st)
|
public CMenu *MenuPush(U8 *st)
|
||||||
{//Save old pulldown menu and replace with new from str.
|
{//Save old pulldown menu and replace with new from str.
|
||||||
CMenu *m=MenuNew(st);
|
CMenu *m = MenuNew(st);
|
||||||
m->next=Fs->cur_menu;
|
m->next = Fs->cur_menu;
|
||||||
Fs->cur_menu=m;
|
Fs->cur_menu = m;
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CMenu *MenuFilePush(U8 *filename)
|
public CMenu *MenuFilePush(U8 *filename)
|
||||||
{//Save old pulldown menu and replace with new from file.
|
{//Save old pulldown menu and replace with new from file.
|
||||||
CMenu *m=MenuFile(filename);
|
CMenu *m = MenuFile(filename);
|
||||||
m->next=Fs->cur_menu;
|
m->next = Fs->cur_menu;
|
||||||
Fs->cur_menu=m;
|
Fs->cur_menu = m;
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 MenuPop()
|
public U0 MenuPop()
|
||||||
{//Restore old pulldown menu. Delete just-deactivated menu.
|
{//Restore old pulldown menu. Delete just-deactivated menu.
|
||||||
CMenu *m=Fs->cur_menu;
|
CMenu *m = Fs->cur_menu;
|
||||||
if (!m) return;
|
if (!m) return;
|
||||||
Fs->cur_menu=m->next;
|
Fs->cur_menu = m->next;
|
||||||
MenuDel(m);
|
MenuDel(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 DrawMenu(CDC *dc)
|
U0 DrawMenu(CDC *dc)
|
||||||
{
|
{
|
||||||
CMenu *m;
|
CMenu *m;
|
||||||
CMenuEntry *tmpme,*tmpse,*cur_submenu=NULL;
|
CMenuEntry *tmpme, *tmpse, *cur_submenu = NULL;
|
||||||
U8 *st=NULL;
|
U8 *st = NULL;
|
||||||
CTask *task=MenuTask;
|
CTask *task = MenuTask;
|
||||||
I64 i,w,x0,y0,x1=mouse.pos.x,y1=mouse.pos.y;
|
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;
|
{
|
||||||
|
sys_cur_submenu_entry = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dc->color=m->attr>>4;
|
dc->color = m->attr >> 4;
|
||||||
GrRect(dc,0,0,GR_WIDTH,FONT_HEIGHT);
|
GrRect(dc, 0, 0, GR_WIDTH, FONT_HEIGHT);
|
||||||
x0=0;
|
x0 = 0;
|
||||||
tmpme=m->sub;
|
tmpme = m->sub;
|
||||||
while (tmpme) {
|
while (tmpme)
|
||||||
w=MenuEntryWidth(tmpme)*FONT_WIDTH;
|
{
|
||||||
if (x0<=x1<x0+w) {
|
w = MenuEntryWidth(tmpme) * FONT_WIDTH;
|
||||||
if (0<=y1<FONT_HEIGHT) {
|
if (x0 <= x1 < x0 + w) {
|
||||||
dc->color=m->attr&15;
|
if (0 <= y1 < FONT_HEIGHT)
|
||||||
GrRect(dc,x0,0,w,FONT_HEIGHT);
|
{
|
||||||
dc->color=m->attr>>4;
|
dc->color = m->attr & 15;
|
||||||
} else
|
GrRect(dc, x0, 0, w, FONT_HEIGHT);
|
||||||
dc->color=m->attr&15;
|
dc->color = m->attr >> 4;
|
||||||
GrPrint(dc,x0,0,"%s",tmpme->name);
|
}
|
||||||
y0=FONT_HEIGHT;
|
else
|
||||||
tmpse=tmpme->sub;
|
dc->color = m->attr & 15;
|
||||||
while (tmpse) {
|
GrPrint(dc, x0, 0, "%s", tmpme->name);
|
||||||
|
y0 = FONT_HEIGHT;
|
||||||
|
tmpse = tmpme->sub;
|
||||||
|
while (tmpse)
|
||||||
|
{
|
||||||
if (tmpse->checked)
|
if (tmpse->checked)
|
||||||
i=m->attr^0xFF;
|
i = m->attr ^ 0xFF;
|
||||||
else
|
else
|
||||||
i=m->attr;
|
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) {
|
if (tmpse->message_code == MESSAGE_KEY_DOWN ||
|
||||||
|
tmpse->message_code == MESSAGE_KEY_DOWN_UP)
|
||||||
|
{
|
||||||
if (!tmpse->arg2)
|
if (!tmpse->arg2)
|
||||||
tmpse->arg2=Char2ScanCode(tmpse->arg1);
|
tmpse->arg2 = Char2ScanCode(tmpse->arg1);
|
||||||
st=ScanCode2KeyName(tmpse->arg2);
|
st = ScanCode2KeyName(tmpse->arg2);
|
||||||
}
|
}
|
||||||
sys_cur_submenu_entry=cur_submenu=tmpse;
|
sys_cur_submenu_entry = cur_submenu = tmpse;
|
||||||
dc->color=i&15;
|
dc->color = i & 15;
|
||||||
GrRect(dc,x0,y0,w,FONT_HEIGHT);
|
GrRect(dc, x0, y0, w, FONT_HEIGHT);
|
||||||
dc->color=i>>4;
|
dc->color = i >> 4;
|
||||||
GrPrint(dc,x0,y0,"%s",tmpse->name);
|
GrPrint(dc, x0, y0, "%s", tmpse->name);
|
||||||
if (st) {
|
if (st)
|
||||||
dc->color=i>>4;
|
{
|
||||||
GrRect(dc,x0+w,y0-FONT_HEIGHT,
|
dc->color = i >> 4;
|
||||||
(StrLen(st)+1)*FONT_WIDTH,FONT_HEIGHT*3);
|
GrRect(dc, x0 + w, y0 - FONT_HEIGHT,
|
||||||
dc->color=i&15;
|
(StrLen(st) + 1) * FONT_WIDTH, FONT_HEIGHT * 3);
|
||||||
GrPrint(dc,x0+w,y0,"%s",st);
|
dc->color = i & 15;
|
||||||
|
GrPrint(dc, x0 + w, y0, "%s", st);
|
||||||
Free(st);
|
Free(st);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
dc->color=i>>4;
|
|
||||||
GrRect(dc,x0,y0,w,FONT_HEIGHT);
|
|
||||||
dc->color=i&15;
|
|
||||||
GrPrint(dc,x0,y0,"%s",tmpse->name);
|
|
||||||
}
|
}
|
||||||
y0+=FONT_HEIGHT;
|
else
|
||||||
tmpse=tmpse->next;
|
{
|
||||||
|
dc->color = i >> 4;
|
||||||
|
GrRect(dc, x0, y0, w, FONT_HEIGHT);
|
||||||
|
dc->color = i & 15;
|
||||||
|
GrPrint(dc, x0, y0, "%s", tmpse->name);
|
||||||
|
}
|
||||||
|
y0 += FONT_HEIGHT;
|
||||||
|
tmpse = tmpse->next;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
dc->color=m->attr&15;
|
|
||||||
GrPrint(dc,x0,0,"%s",tmpme->name);
|
|
||||||
}
|
}
|
||||||
x0+=w;
|
else
|
||||||
tmpme=tmpme->next;
|
{
|
||||||
|
dc->color = m->attr & 15;
|
||||||
|
GrPrint(dc, x0, 0, "%s", tmpme->name);
|
||||||
|
}
|
||||||
|
x0 += w;
|
||||||
|
tmpme = tmpme->next;
|
||||||
}
|
}
|
||||||
sys_cur_submenu_entry=cur_submenu;
|
sys_cur_submenu_entry = cur_submenu;
|
||||||
}
|
}
|
||||||
|
|
1209
src/Zenith/WinMgr.CC
1209
src/Zenith/WinMgr.CC
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue