ZealOS/docs/System/DolDoc/DocRun.CC

159 lines
15 KiB
HolyC
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:monospace;font-size:12pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;DolDoc&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DocEntryRun</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, </span><span class=cF1>Bool</span><span class=cF0> exited, </span><span class=cF9>I64</span><span class=cF0> *_has_action=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l4"></a>{</span><span class=cF2>//Do action on final entry sel by user.</span><span class=cF0>
<a name="l5"></a></span><span class=cF2>//Sometimes returns locked, sometimes unlocked</span><span class=cF0>
<a name="l6"></a> </span><span class=cF1>U8</span><span class=cF0> ch = doc-&gt;cmd_U8, *st;
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cF3>DOCM_CANCEL</span><span class=cF0>, has_action = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l8"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph;
<a name="l9"></a>
<a name="l10"></a> </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (!exited)
<a name="l12"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_ESC</span><span class=cF0>)
<a name="l14"></a> {
<a name="l15"></a> </span><span class=cF5>Message</span><span class=cF0>(</span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>, </span><span class=cF3>CH_ESC</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>JOBf_DONT_FILTER</span><span class=cF0>);
<a name="l16"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l17"></a> </span><span class=cF1>goto</span><span class=cF0> er_done;
<a name="l18"></a> }
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_QUIT</span><span class=cF0>)
<a name="l20"></a> {
<a name="l21"></a> </span><span class=cF5>Message</span><span class=cF0>(</span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>, </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>JOBf_DONT_FILTER</span><span class=cF0>);
<a name="l22"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l23"></a> </span><span class=cF1>goto</span><span class=cF0> er_done;
<a name="l24"></a> }
<a name="l25"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CHECK_COLLAPSABLE</span><span class=cF0>)
<a name="l26"></a> {
<a name="l27"></a> doc_e-&gt;de_flags ^= </span><span class=cF3>DOCEF_CHECKED_COLLAPSED</span><span class=cF0>;
<a name="l28"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l29"></a> }
<a name="l30"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l31"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l32"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF3>CH_SPACE</span><span class=cF0>)
<a name="l34"></a> {
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LINK</span><span class=cF0> &amp;&amp; doc-&gt;left_click_link)
<a name="l36"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l37"></a> res = (*doc-&gt;left_click_link)(doc, doc_e);
<a name="l38"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l39"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_EXP</span><span class=cF0>)
<a name="l41"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l42"></a> res = doc_e-&gt;left_exp;
<a name="l43"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l44"></a> </span><span class=cF5>Message</span><span class=cF0>(</span><span class=cF3>MESSAGE_CMD</span><span class=cF0>, res, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>JOBf_DONT_FILTER</span><span class=cF0>);
<a name="l45"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_CB</span><span class=cF0> &amp;&amp; doc_e-&gt;left_cb)
<a name="l47"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l48"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l49"></a> res = (*doc_e-&gt;left_cb)(doc, doc_e);
<a name="l50"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l51"></a> </span><span class=cF5>Message</span><span class=cF0>(</span><span class=cF3>MESSAGE_CMD</span><span class=cF0>, res, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>JOBf_DONT_FILTER</span><span class=cF0>);
<a name="l52"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l53"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_MACRO</span><span class=cF0>)
<a name="l54"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_POPUP</span><span class=cF0>)
<a name="l56"></a> {
<a name="l57"></a> st = </span><span class=cF5>StrNew</span><span class=cF0>(doc_e-&gt;left_macro);
<a name="l58"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l59"></a> </span><span class=cF5>PopUp</span><span class=cF0>(st, </span><span class=cF5>Fs</span><span class=cF0>);
<a name="l60"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l61"></a> }
<a name="l62"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l63"></a> {
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_IN_STR</span><span class=cF0>)
<a name="l65"></a> </span><span class=cF5>InStr</span><span class=cF0>(</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, doc_e-&gt;left_macro);
<a name="l66"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l67"></a> </span><span class=cF5>In</span><span class=cF0>(</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, doc_e-&gt;left_macro);
<a name="l68"></a> }
<a name="l69"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l70"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (!exited &amp;&amp;
<a name="l72"></a> doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LIST</span><span class=cF0> &amp;&amp;
<a name="l73"></a> doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DEFINE</span><span class=cF0> &amp;&amp;
<a name="l74"></a> </span><span class=cF7>(</span><span class=cF0>tmph = </span><span class=cF5>HashFind</span><span class=cF0>(doc_e-&gt;define_str, doc-&gt;win_task-&gt;hash_table, </span><span class=cF3>HTT_DEFINE_STR</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l75"></a> </span><span class=cF7>(</span><span class=cF0>res = </span><span class=cF5>PopUpPickList</span><span class=cF0>(tmph-&gt;data)</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>DOCM_CANCEL</span><span class=cF0>)
<a name="l76"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l77"></a> </span><span class=cF5>DocDataFormat</span><span class=cF0>(doc, doc_e,res);
<a name="l78"></a> </span><span class=cF5>DocDataScan</span><span class=cF0>(doc, doc_e);
<a name="l79"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l80"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l81"></a> }
<a name="l82"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\n'</span><span class=cF0>)
<a name="l83"></a> {
<a name="l84"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LINK</span><span class=cF0> &amp;&amp; doc-&gt;right_click_link)
<a name="l85"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l86"></a> res = (*doc-&gt;right_click_link)(doc, doc_e);
<a name="l87"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l88"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l89"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_RIGHT_EXP</span><span class=cF0>)
<a name="l90"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l91"></a> res = doc_e-&gt;right_exp;
<a name="l92"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l93"></a> </span><span class=cF5>Message</span><span class=cF0>(</span><span class=cF3>MESSAGE_CMD</span><span class=cF0>, res, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>JOBf_DONT_FILTER</span><span class=cF0>);
<a name="l94"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l95"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_RIGHT_CB</span><span class=cF0> &amp;&amp; doc_e-&gt;right_cb)
<a name="l96"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l97"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l98"></a> res = (*doc_e-&gt;right_cb)(doc, doc_e);
<a name="l99"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l100"></a> </span><span class=cF5>Message</span><span class=cF0>(</span><span class=cF3>MESSAGE_CMD</span><span class=cF0>, res, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>JOBf_DONT_FILTER</span><span class=cF0>);
<a name="l101"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_RIGHT_MACRO</span><span class=cF0>)
<a name="l103"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l104"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_POPUP</span><span class=cF0>)
<a name="l105"></a> {
<a name="l106"></a> st = </span><span class=cF5>StrNew</span><span class=cF0>(doc_e-&gt;right_macro);
<a name="l107"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l108"></a> </span><span class=cF5>PopUp</span><span class=cF0>(st, </span><span class=cF5>Fs</span><span class=cF0>);
<a name="l109"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l110"></a> }
<a name="l111"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l112"></a> {
<a name="l113"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_RIGHT_IN_STR</span><span class=cF0>)
<a name="l114"></a> </span><span class=cF5>InStr</span><span class=cF0>(</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, doc_e-&gt;right_macro);
<a name="l115"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l116"></a> </span><span class=cF5>In</span><span class=cF0>(</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, doc_e-&gt;right_macro);
<a name="l117"></a> }
<a name="l118"></a> has_action = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l119"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l120"></a> }
<a name="l121"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l122"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l123"></a> </span><span class=cF5>DocBottom</span><span class=cF0>(doc);
<a name="l124"></a> doc-&gt;cmd_U8 = </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l125"></a>er_done:
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (_has_action)
<a name="l127"></a> *_has_action = has_action;
<a name="l128"></a>
<a name="l129"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l130"></a>}
</span></pre></body>
</html>