ZealOS/docs/System/Menu.html
TomAwezome 5002ed5880 Fix HTML index file generation.
Fix HTML generation tab width.
2021-07-04 18:11:43 -04:00

317 lines
30 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.05">
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</style>
</head>
<body>
<pre style="font-family:courier;font-size:10pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Menus&quot;</span><span class=cF0>
<a name="l2"></a>#</span><span class=cF1>help_file</span><span class=cF0> </span><span class=cF6>&quot;::/Doc/Menus&quot;</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>
<a name="l8"></a> </span><span class=cF1>while</span><span class=cF0> (res &amp;&amp; !res-&gt;cur_menu)
<a name="l9"></a> res = res-&gt;parent_task;
<a name="l10"></a>
<a name="l11"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l12"></a>}
<a name="l13"></a>
<a name="l14"></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="l15"></a>
<a name="l16"></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>(</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="l17"></a>{</span><span class=cF2>//You probably don't need this. Use dir / and </span><a href="https://tomawezome.github.io/ZealOS/System/Menu.html#l28"><span class=cF4>MenuEntryFind</span></a><span class=cF2>().</span><span class=cF0>
<a name="l18"></a> </span><span class=cF1>while</span><span class=cF0> (haystack_first)
<a name="l19"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>haystack_first-&gt;name, needle_entry_name</span><span class=cF7>)</span><span class=cF0>)
<a name="l21"></a> </span><span class=cF1>return</span><span class=cF0> haystack_first;
<a name="l22"></a> haystack_first = haystack_first-&gt;next;
<a name="l23"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l24"></a>
<a name="l25"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l26"></a>}
<a name="l27"></a>
<a name="l28"></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="l29"></a>{</span><span class=cF2>//Find pulldown entry. Fs-&gt;cur_menu is probably the menu you want.</span><span class=cF0>
<a name="l30"></a></span><span class=cF2>//Just 2 levels -- across top and down are valid, currently.</span><span class=cF0>
<a name="l31"></a> </span><span class=cF1>U8</span><span class=cF0> *st, *st2;
<a name="l32"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
<a name="l33"></a>
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (!haystack_menu || !needle_full_name)
<a name="l35"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l36"></a> st = </span><span class=cF5>StrNew</span><span class=cF0>(needle_full_name);
<a name="l37"></a> st2 = </span><span class=cF5>StrNew</span><span class=cF0>(needle_full_name);
<a name="l38"></a> tmpse = (&amp;haystack_menu-&gt;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="l39"></a> </span><span class=cF1>while</span><span class=cF0> (*st &amp;&amp; tmpse)
<a name="l40"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l41"></a> </span><span class=cF5>StrFirstRemove</span><span class=cF0>(st, </span><span class=cF6>&quot;/&quot;</span><span class=cF0>, st2);
<a name="l42"></a> tmpse=</span><span class=cF5>MenuSubEntryFind</span><span class=cF0>(tmpse-&gt;sub, st2);
<a name="l43"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l44"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l45"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l46"></a>
<a name="l47"></a> </span><span class=cF1>return</span><span class=cF0> tmpse;
<a name="l48"></a>}
<a name="l49"></a>
<a name="l50"></a></span><span class=cF9>CMenuEntry</span><span class=cF0> *</span><span class=cF5>MenuNewSub</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CTask</span><span class=cF0> *task)
<a name="l51"></a>{
<a name="l52"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpme = </span><span class=cF3>NULL</span><span class=cF0>, *tmpse;
<a name="l53"></a>
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token==</span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l55"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l56"></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="l57"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>cc-&gt;cur_str</span><span class=cF7>)</span><span class=cF0> &gt; </span><span class=cFE>31</span><span class=cF0>)
<a name="l58"></a> cc-&gt;cur_str[</span><span class=cFE>31</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
<a name="l59"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(tmpme-&gt;name, cc-&gt;cur_str);
<a name="l60"></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="l61"></a> {
<a name="l62"></a> tmpme-&gt;message_code = </span><span class=cF3>MESSAGE_KEY_DOWN_UP</span><span class=cF0>;
<a name="l63"></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> &amp;&amp; cc-&gt;token != </span><span class=cF6>')'</span><span class=cF0>)
<a name="l64"></a> tmpme-&gt;message_code = </span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l65"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF6>','</span><span class=cF0>)
<a name="l66"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF6>','</span><span class=cF0> &amp;&amp; cc-&gt;token != </span><span class=cF6>')'</span><span class=cF0>)
<a name="l68"></a> tmpme-&gt;arg1 = </span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF6>','</span><span class=cF0>)
<a name="l70"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF6>','</span><span class=cF0> &amp;&amp; cc-&gt;token != </span><span class=cF6>')'</span><span class=cF0>)
<a name="l72"></a> tmpme-&gt;arg2 = </span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF6>')'</span><span class=cF0>)
<a name="l74"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Missing ')' at &quot;</span><span class=cF0>);
<a name="l75"></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="l76"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Missing ';' at&quot;</span><span class=cF0>);
<a name="l77"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ;</span><span class=cF0>
<a name="l78"></a> }
<a name="l79"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF6>'{'</span><span class=cF0>)
<a name="l80"></a> {
<a name="l81"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip {</span><span class=cF0>
<a name="l82"></a> tmpme-&gt;dir = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l83"></a> tmpse = &amp;tmpme-&gt;sub;
<a name="l84"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse &amp;&amp; cc-&gt;token != </span><span class=cF6>'}'</span><span class=cF0>)
<a name="l85"></a> tmpse = tmpse-&gt;next = </span><span class=cF5>MenuNewSub</span><span class=cF0>(cc, task);
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF6>'}'</span><span class=cF0>)
<a name="l87"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Missing '}' at &quot;</span><span class=cF0>);
<a name="l88"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l89"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip }</span><span class=cF0>
<a name="l90"></a> }
<a name="l91"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l92"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Expecting '{' at &quot;</span><span class=cF0>);
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l94"></a> </span><span class=cF1>return</span><span class=cF0> tmpme;
<a name="l95"></a>}
<a name="l96"></a>
<a name="l97"></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 = </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF3>NULL</span><span class=cF0>)
<a name="l98"></a>{</span><span class=cF2>//Parse a menu. You probably don't need this.</span><span class=cF0>
<a name="l99"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m;
<a name="l100"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
<a name="l101"></a> </span><span class=cF9>CCompCtrl</span><span class=cF0> *cc = </span><span class=cF5>CompCtrlNew</span><span class=cF0>(st, </span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>);
<a name="l102"></a>
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l104"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l105"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l106"></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="l107"></a> m-&gt;task = task;
<a name="l108"></a> m-&gt;flags = flags;
<a name="l109"></a> m-&gt;attr = </span><span class=cF3>BLUE</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l110"></a> tmpse = &amp;m-&gt;sub;
<a name="l111"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse)
<a name="l112"></a> tmpse = tmpse-&gt;next = </span><span class=cF5>MenuNewSub</span><span class=cF0>(cc, task);
<a name="l113"></a> </span><span class=cF5>CompCtrlDel</span><span class=cF0>(cc);
<a name="l114"></a>
<a name="l115"></a> </span><span class=cF1>return</span><span class=cF0> m;
<a name="l116"></a>}
<a name="l117"></a>
<a name="l118"></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 = </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF3>NULL</span><span class=cF0>)
<a name="l119"></a>{</span><span class=cF2>//Parse a pulldown menu file. You probably don't need this.</span><span class=cF0>
<a name="l120"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m;
<a name="l121"></a> </span><span class=cF1>U8</span><span class=cF0> *st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;#include \&quot;%s\&quot;&quot;</span><span class=cF0>, filename);
<a name="l122"></a>
<a name="l123"></a> m = </span><span class=cF5>MenuNew</span><span class=cF0>(st, flags, task);
<a name="l124"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l125"></a>
<a name="l126"></a> </span><span class=cF1>return</span><span class=cF0> m;
<a name="l127"></a>}
<a name="l128"></a>
<a name="l129"></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="l130"></a>{
<a name="l131"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse, *tmpse1;
<a name="l132"></a>
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (tmpme)
<a name="l134"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l135"></a> tmpse = tmpme-&gt;sub;
<a name="l136"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse)
<a name="l137"></a> {
<a name="l138"></a> tmpse1 = tmpse-&gt;next;
<a name="l139"></a> </span><span class=cF5>MenuDelSub</span><span class=cF0>(tmpse);
<a name="l140"></a> tmpse = tmpse1;
<a name="l141"></a> }
<a name="l142"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpme);
<a name="l143"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l144"></a>}
<a name="l145"></a>
<a name="l146"></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="l147"></a>{</span><span class=cF2>//Delete a manu. You probably don't need this.</span><span class=cF0>
<a name="l148"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpme, *tmpme1;
<a name="l149"></a>
<a name="l150"></a> </span><span class=cF1>if</span><span class=cF0> (!m)
<a name="l151"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l152"></a> tmpme = m-&gt;sub;
<a name="l153"></a> </span><span class=cF1>while</span><span class=cF0> (tmpme)
<a name="l154"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l155"></a> tmpme1 = tmpme-&gt;next;
<a name="l156"></a> </span><span class=cF5>MenuDelSub</span><span class=cF0>(tmpme);
<a name="l157"></a> tmpme = tmpme1;
<a name="l158"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l159"></a> </span><span class=cF5>Free</span><span class=cF0>(m);
<a name="l160"></a>}
<a name="l161"></a>
<a name="l162"></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="l163"></a>{
<a name="l164"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cF5>StrLen</span><span class=cF0>(tmpme-&gt;name);
<a name="l165"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse = tmpme-&gt;sub;
<a name="l166"></a>
<a name="l167"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse)
<a name="l168"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l169"></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-&gt;name</span><span class=cF7>)</span><span class=cF0>);
<a name="l170"></a> tmpse = tmpse-&gt;next;
<a name="l171"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l172"></a>
<a name="l173"></a> </span><span class=cF1>return</span><span class=cF0> res + </span><span class=cFE>1</span><span class=cF0>;
<a name="l174"></a>}
<a name="l175"></a>
<a name="l176"></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="l177"></a>{</span><span class=cF2>//Save old pulldown menu and replace with new from str.</span><span class=cF0>
<a name="l178"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m = </span><span class=cF5>MenuNew</span><span class=cF0>(st);
<a name="l179"></a>
<a name="l180"></a> m-&gt;next = </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu;
<a name="l181"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu = m;
<a name="l182"></a>
<a name="l183"></a> </span><span class=cF1>return</span><span class=cF0> m;
<a name="l184"></a>}
<a name="l185"></a>
<a name="l186"></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="l187"></a>{</span><span class=cF2>//Save old pulldown menu and replace with new from file.</span><span class=cF0>
<a name="l188"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m = </span><span class=cF5>MenuFile</span><span class=cF0>(filename);
<a name="l189"></a>
<a name="l190"></a> m-&gt;next = </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu;
<a name="l191"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu = m;
<a name="l192"></a>
<a name="l193"></a> </span><span class=cF1>return</span><span class=cF0> m;
<a name="l194"></a>}
<a name="l195"></a>
<a name="l196"></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="l197"></a>{</span><span class=cF2>//Restore old pulldown menu. Delete just-deactivated menu.</span><span class=cF0>
<a name="l198"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m = </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu;
<a name="l199"></a>
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (!m)
<a name="l201"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l202"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu = m-&gt;next;
<a name="l203"></a> </span><span class=cF5>MenuDel</span><span class=cF0>(m);
<a name="l204"></a>}
<a name="l205"></a>
<a name="l206"></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="l207"></a>{
<a name="l208"></a> </span><span class=cF9>CMenu</span><span class=cF0> *m;
<a name="l209"></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="l210"></a> </span><span class=cF1>U8</span><span class=cF0> *st = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l211"></a> </span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF5>MenuTask</span><span class=cF0>;
<a name="l212"></a> </span><span class=cF9>I64</span><span class=cF0> i, w, x0, y0, x1 = </span><span class=cFB>mouse</span><span class=cF0>.pos.x, y1 = </span><span class=cFB>mouse</span><span class=cF0>.pos.y;
<a name="l213"></a>
<a name="l214"></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-&gt;cur_menu</span><span class=cF7>)</span><span class=cF0>)
<a name="l215"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l216"></a> </span><span class=cFB>sys_cur_submenu_entry</span><span class=cF0> = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l217"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l218"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l219"></a> dc-&gt;color = m-&gt;attr &gt;&gt; </span><span class=cFE>4</span><span class=cF0>;
<a name="l220"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>GR_WIDTH</span><span class=cF0>, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>);
<a name="l221"></a> x0 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l222"></a> tmpme = m-&gt;sub;
<a name="l223"></a> </span><span class=cF1>while</span><span class=cF0> (tmpme)
<a name="l224"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l225"></a> w = </span><span class=cF5>MenuEntryWidth</span><span class=cF0>(tmpme) * </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (x0 &lt;= x1 &lt; x0 + w) {
<a name="l227"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= y1 &lt; </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
<a name="l228"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l229"></a> dc-&gt;color = m-&gt;attr &amp; </span><span class=cFE>15</span><span class=cF0>;
<a name="l230"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, x0, </span><span class=cFE>0</span><span class=cF0>, w, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>);
<a name="l231"></a> dc-&gt;color = m-&gt;attr &gt;&gt; </span><span class=cFE>4</span><span class=cF0>;
<a name="l232"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l233"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l234"></a> dc-&gt;color = m-&gt;attr &amp; </span><span class=cFE>15</span><span class=cF0>;
<a name="l235"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, x0, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, tmpme-&gt;name);
<a name="l236"></a> y0 = </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l237"></a> tmpse = tmpme-&gt;sub;
<a name="l238"></a> </span><span class=cF1>while</span><span class=cF0> (tmpse)
<a name="l239"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l240"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse-&gt;checked)
<a name="l241"></a> i = m-&gt;attr ^ </span><span class=cFE>0xFF</span><span class=cF0>;
<a name="l242"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l243"></a> i = m-&gt;attr;
<a name="l244"></a> </span><span class=cF1>if</span><span class=cF0> (y0 &lt;= y1 &lt; y0 + </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
<a name="l245"></a> {
<a name="l246"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse-&gt;message_code == </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> ||
<a name="l247"></a> tmpse-&gt;message_code == </span><span class=cF3>MESSAGE_KEY_DOWN_UP</span><span class=cF0>)
<a name="l248"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l249"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpse-&gt;arg2)
<a name="l250"></a> tmpse-&gt;arg2 = </span><span class=cF5>Char2ScanCode</span><span class=cF0>(tmpse-&gt;arg1);
<a name="l251"></a> st = </span><span class=cF5>ScanCode2KeyName</span><span class=cF0>(tmpse-&gt;arg2);
<a name="l252"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l253"></a> </span><span class=cFB>sys_cur_submenu_entry</span><span class=cF0> = cur_submenu = tmpse;
<a name="l254"></a> dc-&gt;color = i &amp; </span><span class=cFE>15</span><span class=cF0>;
<a name="l255"></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="l256"></a> dc-&gt;color = i &gt;&gt; </span><span class=cFE>4</span><span class=cF0>;
<a name="l257"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, x0, y0, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, tmpse-&gt;name);
<a name="l258"></a> </span><span class=cF1>if</span><span class=cF0> (st)
<a name="l259"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l260"></a> dc-&gt;color = i &gt;&gt; </span><span class=cFE>4</span><span class=cF0>;
<a name="l261"></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="l262"></a> </span><span class=cF7>(</span><span class=cF5>StrLen</span><span class=cF0>(st) + </span><span class=cFE>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> * </span><span class=cFE>3</span><span class=cF0>);
<a name="l263"></a> dc-&gt;color = i &amp; </span><span class=cFE>15</span><span class=cF0>;
<a name="l264"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, x0 + w, y0, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, st);
<a name="l265"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l266"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l267"></a> }
<a name="l268"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l269"></a> {
<a name="l270"></a> dc-&gt;color = i &gt;&gt; </span><span class=cFE>4</span><span class=cF0>;
<a name="l271"></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="l272"></a> dc-&gt;color = i &amp; </span><span class=cFE>15</span><span class=cF0>;
<a name="l273"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, x0, y0, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, tmpse-&gt;name);
<a name="l274"></a> }
<a name="l275"></a> y0 += </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l276"></a> tmpse = tmpse-&gt;next;
<a name="l277"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l278"></a> }
<a name="l279"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l280"></a> {
<a name="l281"></a> dc-&gt;color = m-&gt;attr &amp; </span><span class=cFE>15</span><span class=cF0>;
<a name="l282"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, x0, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, tmpme-&gt;name);
<a name="l283"></a> }
<a name="l284"></a> x0 += w;
<a name="l285"></a> tmpme = tmpme-&gt;next;
<a name="l286"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l287"></a> </span><span class=cFB>sys_cur_submenu_entry</span><span class=cF0> = cur_submenu;
<a name="l288"></a>}
</span></pre></body>
</html>