275 lines
26 KiB
Plaintext
275 lines
26 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="generator" content="TempleOS V5.03">
|
||
|
<meta name="viewport" content="width=device-width">
|
||
|
<link rel="stylesheet" href="/style/templeos.css">
|
||
|
<script src="/script/templeos.js"></script>
|
||
|
<style type="text/css">
|
||
|
.cF0{color:#000000;background-color:#ffffff;}
|
||
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
||
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
||
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
||
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
||
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
||
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
||
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
||
|
.cF8{color:#555555;background-color:#ffffff;}
|
||
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
||
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
||
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
||
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
||
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
||
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
||
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<pre id="content">
|
||
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Menus"</span><span class=cF0>
|
||
|
<a name="l2"></a>#</span><span class=cF1>help_file</span><span class=cF0> </span><span class=cF6>"::/Doc/Menus"</span><span class=cF0>
|
||
|
<a name="l3"></a>
|
||
|
<a name="l4"></a></span><span class=cF9>CTask</span><span class=cF0> *</span><span class=cF5>MenuTask</span><span class=cF0>()
|
||
|
<a name="l5"></a>{
|
||
|
<a name="l6"></a> </span><span class=cF9>CTask</span><span class=cF0> *res=</span><span class=cFB>sys_focus_task</span><span class=cF0>;
|
||
|
<a name="l7"></a> </span><span class=cF1>while</span><span class=cF0> (res && !res->cur_menu)
|
||
|
<a name="l8"></a> res=res->parent_task;
|
||
|
<a name="l9"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l10"></a>}
|
||
|
<a name="l11"></a>
|
||
|
<a name="l12"></a></span><span class=cF9>CMenuEntry</span><span class=cF0> *</span><span class=cFB>sys_cur_submenu_entry</span><span class=cF0>=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l13"></a>
|
||
|
<a name="l14"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CMenuEntry</span><span class=cF0> *</span><span class=cF5>MenuSubEntryFind</span><span class=cF0>(
|
||
|
<a name="l15"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *haystack_first,</span><span class=cF1>U8</span><span class=cF0> *needle_entry_name)
|
||
|
<a name="l16"></a>{</span><span class=cF2>//You probably don't need this. Use dir / and </span><a href="/Wb/Adam/Menu.HC.HTML#l25"><span class=cF4>MenuEntryFind</span></a><span class=cF2>().</span><span class=cF0>
|
||
|
<a name="l17"></a> </span><span class=cF1>while</span><span class=cF0> (haystack_first) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>haystack_first->name,needle_entry_name</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l19"></a> </span><span class=cF1>return</span><span class=cF0> haystack_first;
|
||
|
<a name="l20"></a> haystack_first=haystack_first->next;
|
||
|
<a name="l21"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l22"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l23"></a>}
|
||
|
<a name="l24"></a>
|
||
|
<a name="l25"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CMenuEntry</span><span class=cF0> *</span><span class=cF5>MenuEntryFind</span><span class=cF0>(</span><span class=cF9>CMenu</span><span class=cF0> *haystack_menu,</span><span class=cF1>U8</span><span class=cF0> *needle_full_name)
|
||
|
<a name="l26"></a>{</span><span class=cF2>//Find pulldown entry. Fs->cur_menu is probably the menu you want.</span><span class=cF0>
|
||
|
<a name="l27"></a></span><span class=cF2>//Just 2 levels -- across top and down are valid, currently.</span><span class=cF0>
|
||
|
<a name="l28"></a> </span><span class=cF1>U8</span><span class=cF0> *st,*st2;
|
||
|
<a name="l29"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
|
||
|
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (!haystack_menu || !needle_full_name)
|
||
|
<a name="l31"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l32"></a> st=</span><span class=cF5>StrNew</span><span class=cF0>(needle_full_name);
|
||
|
<a name="l33"></a> st2=</span><span class=cF5>StrNew</span><span class=cF0>(needle_full_name);
|
||
|
<a name="l34"></a> tmpse=(&haystack_menu->sub)(</span><span class=cF1>U8</span><span class=cF0> *)-</span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CMenuEntry</span><span class=cF0>.sub);
|
||
|
<a name="l35"></a> </span><span class=cF1>while</span><span class=cF0> (*st && tmpse) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l36"></a> </span><span class=cF5>StrFirstRem</span><span class=cF0>(st,</span><span class=cF6>"/"</span><span class=cF0>,st2);
|
||
|
<a name="l37"></a> tmpse=</span><span class=cF5>MenuSubEntryFind</span><span class=cF0>(tmpse->sub,st2);
|
||
|
<a name="l38"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l39"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||
|
<a name="l40"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
|
||
|
<a name="l41"></a> </span><span class=cF1>return</span><span class=cF0> tmpse;
|
||
|
<a name="l42"></a>}
|
||
|
<a name="l43"></a>
|
||
|
<a name="l44"></a></span><span class=cF9>CMenuEntry</span><span class=cF0> *</span><span class=cF5>MenuNewSub</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CTask</span><span class=cF0> *task)
|
||
|
<a name="l45"></a>{
|
||
|
<a name="l46"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpme=</span><span class=cF3>NULL</span><span class=cF0>,*tmpse;
|
||
|
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_IDENT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l48"></a> tmpme=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMenuEntry</span><span class=cF7>)</span><span class=cF0>,task);
|
||
|
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cc->cur_str</span><span class=cF7>)</span><span class=cF0>>31)
|
||
|
<a name="l50"></a> cc->cur_str[31]=0;
|
||
|
<a name="l51"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(tmpme->name,cc->cur_str);
|
||
|
<a name="l52"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>==</span><span class=cF6>'('</span><span class=cF0>) {
|
||
|
<a name="l53"></a> tmpme->msg_code=</span><span class=cF3>MSG_KEY_DOWN_UP</span><span class=cF0>;
|
||
|
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>!=</span><span class=cF6>','</span><span class=cF0> && cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
||
|
<a name="l55"></a> tmpme->msg_code=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
|
||
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>','</span><span class=cF0>)
|
||
|
<a name="l57"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
||
|
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>','</span><span class=cF0> && cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
||
|
<a name="l59"></a> tmpme->arg1=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
|
||
|
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>','</span><span class=cF0>)
|
||
|
<a name="l61"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
||
|
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>','</span><span class=cF0> && cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
||
|
<a name="l63"></a> tmpme->arg2=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
|
||
|
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
||
|
<a name="l65"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
||
|
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>!=</span><span class=cF6>';'</span><span class=cF0>)
|
||
|
<a name="l67"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
||
|
<a name="l68"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ;</span><span class=cF0>
|
||
|
<a name="l69"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'{'</span><span class=cF0>) {
|
||
|
<a name="l70"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
|
||
|
<a name="l71"></a> tmpme->dir=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l72"></a> tmpse=&tmpme->sub;
|
||
|
<a name="l73"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse && cc->token!=</span><span class=cF6>'}'</span><span class=cF0>)
|
||
|
<a name="l74"></a> tmpse=tmpse->next=</span><span class=cF5>MenuNewSub</span><span class=cF0>(cc,task);
|
||
|
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>'}'</span><span class=cF0>)
|
||
|
<a name="l76"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing '}' at "</span><span class=cF0>);
|
||
|
<a name="l77"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l78"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip }</span><span class=cF0>
|
||
|
<a name="l79"></a> } </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l80"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '{' at "</span><span class=cF0>);
|
||
|
<a name="l81"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l82"></a> </span><span class=cF1>return</span><span class=cF0> tmpme;
|
||
|
<a name="l83"></a>}
|
||
|
<a name="l84"></a>
|
||
|
<a name="l85"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CMenu</span><span class=cF0> *</span><span class=cF5>MenuNew</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st,</span><span class=cF9>I64</span><span class=cF0> flags=0,</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l86"></a>{</span><span class=cF2>//Parse a menu. You probably don't need this.</span><span class=cF0>
|
||
|
<a name="l87"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m;
|
||
|
<a name="l88"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
|
||
|
<a name="l89"></a> </span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc=</span><span class=cF5>CmpCtrlNew</span><span class=cF0>(st,</span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>);
|
||
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
|
||
|
<a name="l91"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
||
|
<a name="l92"></a> m=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMenu</span><span class=cF7>)</span><span class=cF0>,task);
|
||
|
<a name="l93"></a> m->task=task;
|
||
|
<a name="l94"></a> m->flags=flags;
|
||
|
<a name="l95"></a> m->attr =</span><span class=cF3>BLUE</span><span class=cF0><<4+</span><span class=cF3>YELLOW</span><span class=cF0>;
|
||
|
<a name="l96"></a> tmpse=&m->sub;
|
||
|
<a name="l97"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse)
|
||
|
<a name="l98"></a> tmpse=tmpse->next=</span><span class=cF5>MenuNewSub</span><span class=cF0>(cc,task);
|
||
|
<a name="l99"></a> </span><span class=cF5>CmpCtrlDel</span><span class=cF0>(cc);
|
||
|
<a name="l100"></a> </span><span class=cF1>return</span><span class=cF0> m;
|
||
|
<a name="l101"></a>}
|
||
|
<a name="l102"></a>
|
||
|
<a name="l103"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CMenu</span><span class=cF0> *</span><span class=cF5>MenuFile</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename,</span><span class=cF9>I64</span><span class=cF0> flags=0,</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l104"></a>{</span><span class=cF2>//Parse a pulldown menu file. You probably don't need this.</span><span class=cF0>
|
||
|
<a name="l105"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m;
|
||
|
<a name="l106"></a> </span><span class=cF1>U8</span><span class=cF0> *st=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"#include \"%s\""</span><span class=cF0>,filename);
|
||
|
<a name="l107"></a> m=</span><span class=cF5>MenuNew</span><span class=cF0>(st,flags,task);
|
||
|
<a name="l108"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||
|
<a name="l109"></a> </span><span class=cF1>return</span><span class=cF0> m;
|
||
|
<a name="l110"></a>}
|
||
|
<a name="l111"></a>
|
||
|
<a name="l112"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MenuDelSub</span><span class=cF0>(</span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpme)
|
||
|
<a name="l113"></a>{
|
||
|
<a name="l114"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse,*tmpse1;
|
||
|
<a name="l115"></a> </span><span class=cF1>if</span><span class=cF0> (tmpme) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l116"></a> tmpse=tmpme->sub;
|
||
|
<a name="l117"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse) {
|
||
|
<a name="l118"></a> tmpse1=tmpse->next;
|
||
|
<a name="l119"></a> </span><span class=cF5>MenuDelSub</span><span class=cF0>(tmpse);
|
||
|
<a name="l120"></a> tmpse=tmpse1;
|
||
|
<a name="l121"></a> }
|
||
|
<a name="l122"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpme);
|
||
|
<a name="l123"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l124"></a>}
|
||
|
<a name="l125"></a>
|
||
|
<a name="l126"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MenuDel</span><span class=cF0>(</span><span class=cF9>CMenu</span><span class=cF0> *m)
|
||
|
<a name="l127"></a>{</span><span class=cF2>//Delete a manu. You probably don't need this.</span><span class=cF0>
|
||
|
<a name="l128"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpme,*tmpme1;
|
||
|
<a name="l129"></a> </span><span class=cF1>if</span><span class=cF0> (!m) </span><span class=cF1>return</span><span class=cF0>;
|
||
|
<a name="l130"></a> tmpme=m->sub;
|
||
|
<a name="l131"></a> </span><span class=cF1>while</span><span class=cF0> (tmpme) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l132"></a> tmpme1=tmpme->next;
|
||
|
<a name="l133"></a> </span><span class=cF5>MenuDelSub</span><span class=cF0>(tmpme);
|
||
|
<a name="l134"></a> tmpme=tmpme1;
|
||
|
<a name="l135"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l136"></a> </span><span class=cF5>Free</span><span class=cF0>(m);
|
||
|
<a name="l137"></a>}
|
||
|
<a name="l138"></a>
|
||
|
<a name="l139"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>MenuEntryWidth</span><span class=cF0>(</span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpme)
|
||
|
<a name="l140"></a>{
|
||
|
<a name="l141"></a> </span><span class=cF9>I64</span><span class=cF0> res=</span><span class=cF5>StrLen</span><span class=cF0>(tmpme->name);
|
||
|
<a name="l142"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse=tmpme->sub;
|
||
|
<a name="l143"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l144"></a> res=</span><span class=cF5>MaxI64</span><span class=cF0>(res,</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>tmpse->name</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l145"></a> tmpse=tmpse->next;
|
||
|
<a name="l146"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l147"></a> </span><span class=cF1>return</span><span class=cF0> res+1;
|
||
|
<a name="l148"></a>}
|
||
|
<a name="l149"></a>
|
||
|
<a name="l150"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CMenu</span><span class=cF0> *</span><span class=cF5>MenuPush</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
|
||
|
<a name="l151"></a>{</span><span class=cF2>//Save old pulldown menu and replace with new from str.</span><span class=cF0>
|
||
|
<a name="l152"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m=</span><span class=cF5>MenuNew</span><span class=cF0>(st);
|
||
|
<a name="l153"></a> m->next=</span><span class=cF5>Fs</span><span class=cF0>->cur_menu;
|
||
|
<a name="l154"></a> </span><span class=cF5>Fs</span><span class=cF0>->cur_menu=m;
|
||
|
<a name="l155"></a> </span><span class=cF1>return</span><span class=cF0> m;
|
||
|
<a name="l156"></a>}
|
||
|
<a name="l157"></a>
|
||
|
<a name="l158"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CMenu</span><span class=cF0> *</span><span class=cF5>MenuFilePush</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename)
|
||
|
<a name="l159"></a>{</span><span class=cF2>//Save old pulldown menu and replace with new from file.</span><span class=cF0>
|
||
|
<a name="l160"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m=</span><span class=cF5>MenuFile</span><span class=cF0>(filename);
|
||
|
<a name="l161"></a> m->next=</span><span class=cF5>Fs</span><span class=cF0>->cur_menu;
|
||
|
<a name="l162"></a> </span><span class=cF5>Fs</span><span class=cF0>->cur_menu=m;
|
||
|
<a name="l163"></a> </span><span class=cF1>return</span><span class=cF0> m;
|
||
|
<a name="l164"></a>}
|
||
|
<a name="l165"></a>
|
||
|
<a name="l166"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MenuPop</span><span class=cF0>()
|
||
|
<a name="l167"></a>{</span><span class=cF2>//Restore old pulldown menu. Delete just-deactivated menu.</span><span class=cF0>
|
||
|
<a name="l168"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m=</span><span class=cF5>Fs</span><span class=cF0>->cur_menu;
|
||
|
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (!m) </span><span class=cF1>return</span><span class=cF0>;
|
||
|
<a name="l170"></a> </span><span class=cF5>Fs</span><span class=cF0>->cur_menu=m->next;
|
||
|
<a name="l171"></a> </span><span class=cF5>MenuDel</span><span class=cF0>(m);
|
||
|
<a name="l172"></a>}
|
||
|
<a name="l173"></a>
|
||
|
<a name="l174"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawMenu</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc)
|
||
|
<a name="l175"></a>{
|
||
|
<a name="l176"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m;
|
||
|
<a name="l177"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpme,*tmpse,*cur_submenu=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l178"></a> </span><span class=cF1>U8</span><span class=cF0> *st=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l179"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF5>MenuTask</span><span class=cF0>;
|
||
|
<a name="l180"></a> </span><span class=cF9>I64</span><span class=cF0> i,w,x0,y0,x1=</span><span class=cFB>ms</span><span class=cF0>.pos.x,y1=</span><span class=cFB>ms</span><span class=cF0>.pos.y;
|
||
|
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>m=task->cur_menu</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l182"></a> </span><span class=cFB>sys_cur_submenu_entry</span><span class=cF0>=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l183"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||
|
<a name="l184"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l185"></a> dc->color=m->attr>>4;
|
||
|
<a name="l186"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,0,0,</span><span class=cF3>GR_WIDTH</span><span class=cF0>,</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>);
|
||
|
<a name="l187"></a> x0=0;
|
||
|
<a name="l188"></a> tmpme=m->sub;
|
||
|
<a name="l189"></a> </span><span class=cF1>while</span><span class=cF0> (tmpme) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l190"></a> w=</span><span class=cF5>MenuEntryWidth</span><span class=cF0>(tmpme)*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
|
||
|
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (x0<=x1<x0+w) {
|
||
|
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (0<=y1<</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l193"></a> dc->color=m->attr&15;
|
||
|
<a name="l194"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,x0,0,w,</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>);
|
||
|
<a name="l195"></a> dc->color=m->attr>>4;
|
||
|
<a name="l196"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l197"></a> dc->color=m->attr&15;
|
||
|
<a name="l198"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,x0,0,</span><span class=cF6>"%s"</span><span class=cF0>,tmpme->name);
|
||
|
<a name="l199"></a> y0=</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
|
||
|
<a name="l200"></a> tmpse=tmpme->sub;
|
||
|
<a name="l201"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l202"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse->checked)
|
||
|
<a name="l203"></a> i=m->attr^0xFF;
|
||
|
<a name="l204"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l205"></a> i=m->attr;
|
||
|
<a name="l206"></a> </span><span class=cF1>if</span><span class=cF0> (y0<=y1<y0+</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>) {
|
||
|
<a name="l207"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse->msg_code==</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>||
|
||
|
<a name="l208"></a> tmpse->msg_code==</span><span class=cF3>MSG_KEY_DOWN_UP</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l209"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpse->arg2)
|
||
|
<a name="l210"></a> tmpse->arg2=</span><span class=cF5>Char2ScanCode</span><span class=cF0>(tmpse->arg1);
|
||
|
<a name="l211"></a> st=</span><span class=cF5>ScanCode2KeyName</span><span class=cF0>(tmpse->arg2);
|
||
|
<a name="l212"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l213"></a> </span><span class=cFB>sys_cur_submenu_entry</span><span class=cF0>=cur_submenu=tmpse;
|
||
|
<a name="l214"></a> dc->color=i&15;
|
||
|
<a name="l215"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,x0,y0,w,</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>);
|
||
|
<a name="l216"></a> dc->color=i>>4;
|
||
|
<a name="l217"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,x0,y0,</span><span class=cF6>"%s"</span><span class=cF0>,tmpse->name);
|
||
|
<a name="l218"></a> </span><span class=cF1>if</span><span class=cF0> (st) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l219"></a> dc->color=i>>4;
|
||
|
<a name="l220"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,x0+w,y0-</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>,
|
||
|
<a name="l221"></a> </span><span class=cF7>(</span><span class=cF5>StrLen</span><span class=cF0>(st)+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>,</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>*3);
|
||
|
<a name="l222"></a> dc->color=i&15;
|
||
|
<a name="l223"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,x0+w,y0,</span><span class=cF6>"%s"</span><span class=cF0>,st);
|
||
|
<a name="l224"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||
|
<a name="l225"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l226"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
||
|
<a name="l227"></a> dc->color=i>>4;
|
||
|
<a name="l228"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,x0,y0,w,</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>);
|
||
|
<a name="l229"></a> dc->color=i&15;
|
||
|
<a name="l230"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,x0,y0,</span><span class=cF6>"%s"</span><span class=cF0>,tmpse->name);
|
||
|
<a name="l231"></a> }
|
||
|
<a name="l232"></a> y0+=</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
|
||
|
<a name="l233"></a> tmpse=tmpse->next;
|
||
|
<a name="l234"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l235"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
||
|
<a name="l236"></a> dc->color=m->attr&15;
|
||
|
<a name="l237"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,x0,0,</span><span class=cF6>"%s"</span><span class=cF0>,tmpme->name);
|
||
|
<a name="l238"></a> }
|
||
|
<a name="l239"></a> x0+=w;
|
||
|
<a name="l240"></a> tmpme=tmpme->next;
|
||
|
<a name="l241"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l242"></a> </span><span class=cFB>sys_cur_submenu_entry</span><span class=cF0>=cur_submenu;
|
||
|
<a name="l243"></a>}
|
||
|
</span></pre></body>
|
||
|
</html>
|