templeos-info/public/Wb/Adam/DolDoc/DocDblBuf.HC.HTML

142 lines
14 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!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>&quot;DolDoc/Task;StdOut/Task&quot;</span><span class=cF0>
<a name="l2"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CDoc</span><span class=cF0> *</span><span class=cF5>DocPut</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="l3"></a>{</span><span class=cF2>//Current document that StdOut Put() goes to.</span><span class=cF0>
<a name="l4"></a></span><span class=cF2>//Basically, StdOut unless double buffering.</span><span class=cF0>
<a name="l5"></a> </span><span class=cF9>CDoc</span><span class=cF0> *res;
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l7"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;task_flags,</span><span class=cF3>TASKf_INPUT_FILTER_TASK</span><span class=cF7>)</span><span class=cF0>)
<a name="l8"></a> task=task-&gt;parent_task;
<a name="l9"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>res=task-&gt;put_doc</span><span class=cF7>)</span><span class=cF0> &amp;&amp; res-&gt;doc_signature==</span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
<a name="l10"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l11"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l12"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l13"></a>}
<a name="l14"></a>
<a name="l15"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CDoc</span><span class=cF0> *</span><span class=cF5>DocDisplay</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="l16"></a>{</span><span class=cF2>//StdOut displayed unless double buffering.</span><span class=cF0>
<a name="l17"></a> </span><span class=cF9>CDoc</span><span class=cF0> *res;
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>res=task-&gt;display_doc</span><span class=cF7>)</span><span class=cF0> &amp;&amp; res-&gt;doc_signature==</span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
<a name="l20"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l21"></a> </span><span class=cF1>else</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>CDoc</span><span class=cF0> *</span><span class=cF5>DocBorder</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="l26"></a>{</span><span class=cF2>//Doc holding border of window text.</span><span class=cF0>
<a name="l27"></a> </span><span class=cF9>CDoc</span><span class=cF0> *res;
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>res=task-&gt;border_doc</span><span class=cF7>)</span><span class=cF0> &amp;&amp; res-&gt;doc_signature==</span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
<a name="l30"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l31"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l32"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l33"></a>}
<a name="l34"></a>
<a name="l35"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CDoc</span><span class=cF0> *</span><span class=cF5>DocDblBufStart</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="l36"></a>{</span><span class=cF2>//See </span><a href="/Wb/Demo/Spy.HC.HTML#l1"><span class=cF4>::/Demo/Spy.HC</span></a><span class=cF0>
<a name="l37"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_ddoc;
<a name="l38"></a> </span><span class=cF9>CDoc</span><span class=cF0> *pdoc=</span><span class=cF5>DocPut</span><span class=cF0>(task),*ddoc=</span><span class=cF5>DocDisplay</span><span class=cF0>(task),*res;
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (!pdoc || !ddoc || pdoc!=ddoc)
<a name="l40"></a> res=</span><span class=cF3>NULL</span><span class=cF0>; </span><span class=cF2>//Already Double buffering</span><span class=cF0>
<a name="l41"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l42"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l43"></a> unlock_ddoc=</span><span class=cF5>DocLock</span><span class=cF0>(ddoc); </span><span class=cF2>//dont change during winupdate, so lock DocPut</span><span class=cF0>
<a name="l44"></a> res=</span><span class=cF5>DocNew</span><span class=cF0>(,task);
<a name="l45"></a> res-&gt;win_task =ddoc-&gt;win_task;
<a name="l46"></a> res-&gt;max_entries =ddoc-&gt;max_entries;
<a name="l47"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res-&gt;find_replace,ddoc-&gt;find_replace,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFindText</span><span class=cF7>)</span><span class=cF0>);
<a name="l48"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&amp;res-&gt;filename,&amp;ddoc-&gt;filename,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFileName</span><span class=cF7>)</span><span class=cF0>);
<a name="l49"></a> res-&gt;left_click_link =ddoc-&gt;left_click_link;
<a name="l50"></a> res-&gt;right_click_link =ddoc-&gt;right_click_link;
<a name="l51"></a> res-&gt;user_put_data =ddoc-&gt;user_put_data;
<a name="l52"></a> res-&gt;user_put_key =ddoc-&gt;user_put_key;
<a name="l53"></a> res-&gt;user_put_s =ddoc-&gt;user_put_s;
<a name="l54"></a> res-&gt;parent_doc =ddoc-&gt;parent_doc;
<a name="l55"></a> res-&gt;desc =ddoc-&gt;desc;
<a name="l56"></a> res-&gt;user_data =ddoc-&gt;user_data;
<a name="l57"></a> res-&gt;flags|=ddoc-&gt;flags&amp;</span><span class=cF3>DOCG_DBL_BUF_FLAGS</span><span class=cF0> | </span><span class=cF3>DOCF_DONT_SHOW</span><span class=cF0>;
<a name="l58"></a> task-&gt;put_doc=res;
<a name="l59"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_ddoc)
<a name="l60"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(ddoc);
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l62"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l63"></a>}
<a name="l64"></a>
<a name="l65"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocDblBufEnd</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="l66"></a>{</span><span class=cF2>//See </span><a href="/Wb/Demo/Spy.HC.HTML#l1"><span class=cF4>::/Demo/Spy.HC</span></a><span class=cF0>
<a name="l67"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l68"></a> </span><span class=cF9>CDoc</span><span class=cF0> *pdoc=</span><span class=cF5>DocPut</span><span class=cF0>(task),*ddoc=</span><span class=cF5>DocDisplay</span><span class=cF0>(task);
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (pdoc &amp;&amp; ddoc &amp;&amp; pdoc!=ddoc) </span><span class=cF7>{</span><span class=cF2>//Double buffering?</span><span class=cF0>
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l71"></a> ddoc-&gt;flags|=</span><span class=cF3>DOCF_DONT_SHOW</span><span class=cF0>;
<a name="l72"></a> pdoc-&gt;flags&amp;=~</span><span class=cF3>DOCF_DONT_SHOW</span><span class=cF0>;
<a name="l73"></a> </span><span class=cF5>DocLock</span><span class=cF0>(ddoc);
<a name="l74"></a> task-&gt;display_doc=pdoc;
<a name="l75"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(ddoc);
<a name="l76"></a> </span><span class=cF5>DocDel</span><span class=cF0>(ddoc);
<a name="l77"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l79"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l80"></a>}
<a name="l81"></a>
<a name="l82"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocDblBufSwap</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="l83"></a>{</span><span class=cF2>//See </span><a href="/Wb/Demo/Spy.HC.HTML#l1"><span class=cF4>::/Demo/Spy.HC</span></a><span class=cF0>
<a name="l84"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l85"></a> </span><span class=cF9>CDoc</span><span class=cF0> *pdoc=</span><span class=cF5>DocPut</span><span class=cF0>(task),*ddoc=</span><span class=cF5>DocDisplay</span><span class=cF0>(task);
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (pdoc &amp;&amp; ddoc &amp;&amp; pdoc!=ddoc) </span><span class=cF7>{</span><span class=cF2>//Double buffering?</span><span class=cF0>
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l88"></a> ddoc-&gt;flags|=</span><span class=cF3>DOCF_DONT_SHOW</span><span class=cF0>;
<a name="l89"></a> pdoc-&gt;flags&amp;=~</span><span class=cF3>DOCF_DONT_SHOW</span><span class=cF0>;
<a name="l90"></a> </span><span class=cF5>DocLock</span><span class=cF0>(ddoc);
<a name="l91"></a> task-&gt;display_doc=pdoc;
<a name="l92"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(ddoc);
<a name="l93"></a> </span><span class=cF5>DocRst</span><span class=cF0>(ddoc,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l94"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(ddoc-&gt;find_replace,pdoc-&gt;find_replace,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFindText</span><span class=cF7>)</span><span class=cF0>);
<a name="l95"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&amp;ddoc-&gt;filename,&amp;pdoc-&gt;filename,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CEdFileName</span><span class=cF7>)</span><span class=cF0>);
<a name="l96"></a> ddoc-&gt;max_entries =pdoc-&gt;max_entries;
<a name="l97"></a> ddoc-&gt;flags =pdoc-&gt;flags&amp;</span><span class=cF3>DOCG_DBL_BUF_FLAGS</span><span class=cF0> |
<a name="l98"></a> ddoc-&gt;flags&amp;~</span><span class=cF3>DOCG_DBL_BUF_FLAGS</span><span class=cF0>;
<a name="l99"></a> ddoc-&gt;left_click_link =pdoc-&gt;left_click_link;
<a name="l100"></a> ddoc-&gt;right_click_link =pdoc-&gt;right_click_link;
<a name="l101"></a> ddoc-&gt;user_put_data =pdoc-&gt;user_put_data;
<a name="l102"></a> ddoc-&gt;user_put_key =pdoc-&gt;user_put_key;
<a name="l103"></a> ddoc-&gt;user_put_s =pdoc-&gt;user_put_s;
<a name="l104"></a> ddoc-&gt;desc =pdoc-&gt;desc;
<a name="l105"></a> ddoc-&gt;user_data =pdoc-&gt;user_data;
<a name="l106"></a> task-&gt;put_doc=ddoc;
<a name="l107"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l108"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l109"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l110"></a>}
</span></pre></body>
</html>