ZealOS/docs/System/DolDoc/DocClipBoard.ZC.html
2021-12-11 06:10:58 -05:00

174 lines
16 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.07">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</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/Clip&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cFB>sys_clip_doc</span><span class=cF0> = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l4"></a>
<a name="l5"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ClipDel</span><span class=cF0>()
<a name="l6"></a>{</span><span class=cF2>//Delete everything on clip.</span><span class=cF0>
<a name="l7"></a> </span><span class=cF5>DocReset</span><span class=cF0>(</span><span class=cFB>sys_clip_doc</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l8"></a>}
<a name="l9"></a>
<a name="l10"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ClipCopy</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l11"></a>{</span><span class=cF2>//Copy </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1090"><span class=cF4>DOCET_SEL</span></a><span class=cF2> flagged entries to clip.</span><span class=cF0>
<a name="l12"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc2 = </span><span class=cFB>sys_clip_doc</span><span class=cF0>;
<a name="l13"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(doc), unlock_doc2 = </span><span class=cF5>DocLock</span><span class=cF0>(doc2);
<a name="l14"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e = doc-&gt;head.next, *doc_ne;
<a name="l15"></a>
<a name="l16"></a> </span><span class=cF5>ClipDel</span><span class=cF0>;
<a name="l17"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
<a name="l18"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type &amp; </span><span class=cF3>DOCET_SEL</span><span class=cF0>)
<a name="l20"></a> {
<a name="l21"></a> doc_e-&gt;type &amp;= ~</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>doldoc</span><span class=cF0>.type_flags_data, doc_e-&gt;type_u8</span><span class=cF7>)</span><span class=cF0>)
<a name="l23"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l24"></a> doc_ne = </span><span class=cF5>DocEntryCopy</span><span class=cF0>(doc2, doc_e);
<a name="l25"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc2-&gt;head.last);
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l27"></a> }
<a name="l28"></a> doc_e = doc_e-&gt;next;
<a name="l29"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc2)
<a name="l31"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc2);
<a name="l32"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l33"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l34"></a>}
<a name="l35"></a>
<a name="l36"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ClipCut</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l37"></a>{</span><span class=cF2>//Remove sel entries and place on clip.</span><span class=cF0>
<a name="l38"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc2 = </span><span class=cFB>sys_clip_doc</span><span class=cF0>;
<a name="l39"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(doc), unlock_doc2 = </span><span class=cF5>DocLock</span><span class=cF0>(doc2);
<a name="l40"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e = doc-&gt;head.next, *doc_e1, *doc_ne, *doc_e2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l41"></a>
<a name="l42"></a> </span><span class=cF5>ClipDel</span><span class=cF0>;
<a name="l43"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
<a name="l44"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l45"></a> doc_e1 = doc_e-&gt;next;
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type &amp; </span><span class=cF3>DOCET_SEL</span><span class=cF0>)
<a name="l47"></a> {
<a name="l48"></a> doc_e-&gt;type &amp;= ~</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>doldoc</span><span class=cF0>.type_flags_data, doc_e-&gt;type_u8</span><span class=cF7>)</span><span class=cF0>)
<a name="l50"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l51"></a> doc_ne = </span><span class=cF5>DocEntryCopy</span><span class=cF0>(doc2, doc_e);
<a name="l52"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc2-&gt;head.last);
<a name="l53"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc-&gt;cur_entry || doc_e == doc_e2)
<a name="l55"></a> doc_e2 = doc_e-&gt;next;
<a name="l56"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_e);
<a name="l57"></a> }
<a name="l58"></a> doc_e = doc_e1;
<a name="l59"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2)
<a name="l61"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l62"></a> doc-&gt;cur_entry = doc_e2;
<a name="l63"></a> doc-&gt;cur_col = doc_e2-&gt;min_col;
<a name="l64"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l65"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc, </span><span class=cF3>NULL</span><span class=cF0>);
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc2)
<a name="l67"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc2);
<a name="l68"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l69"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l70"></a>}
<a name="l71"></a>
<a name="l72"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ClipPaste</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l73"></a>{</span><span class=cF2>//Insert copy of clip at insert pt, cur_entry.</span><span class=cF0>
<a name="l74"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc2 = </span><span class=cFB>sys_clip_doc</span><span class=cF0>;
<a name="l75"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(doc), unlock_doc2 = </span><span class=cF5>DocLock</span><span class=cF0>(doc2);
<a name="l76"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry, *doc_e;
<a name="l77"></a>
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_DATA</span><span class=cF0>)
<a name="l79"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l80"></a> doc_e = doc2-&gt;head.next;
<a name="l81"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc2)
<a name="l82"></a> {
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TAG</span><span class=cF0>)
<a name="l84"></a> </span><span class=cF5>DocPrintPartial</span><span class=cF0>(doc, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, doc_e-&gt;tag);
<a name="l85"></a> doc_e = doc_e-&gt;next;
<a name="l86"></a> }
<a name="l87"></a> </span><span class=cF7>}</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>DocInsDoc</span><span class=cF0>(doc, doc2);
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc2)
<a name="l91"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc2);
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l93"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l94"></a>}
<a name="l95"></a>
<a name="l96"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocCut</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF1>start</span><span class=cF0>, </span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF1>end</span><span class=cF0>)
<a name="l97"></a>{</span><span class=cF2>//Del start to end entry, including end points.</span><span class=cF0>
<a name="l98"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l99"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e1;
<a name="l100"></a>
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0> != doc &amp;&amp; </span><span class=cF7>(</span><span class=cF1>start</span><span class=cF0>-&gt;last != </span><span class=cF1>end</span><span class=cF0> || </span><span class=cF1>end</span><span class=cF0> == doc</span><span class=cF7>)</span><span class=cF0>)
<a name="l102"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l103"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l104"></a> doc_e1 = </span><span class=cF1>start</span><span class=cF0>-&gt;next;
<a name="l105"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0> == doc-&gt;cur_entry)
<a name="l106"></a> {
<a name="l107"></a> doc-&gt;cur_entry = </span><span class=cF1>start</span><span class=cF0>-&gt;next;
<a name="l108"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l109"></a> }
<a name="l110"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, </span><span class=cF1>start</span><span class=cF0>);
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0> == </span><span class=cF1>end</span><span class=cF0>)
<a name="l112"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l113"></a> </span><span class=cF1>start</span><span class=cF0> = doc_e1;
<a name="l114"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l115"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0> != doc);
<a name="l116"></a>
<a name="l117"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc, </span><span class=cF3>NULL</span><span class=cF0>);
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l119"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l120"></a>}
<a name="l121"></a>
<a name="l122"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CDoc</span><span class=cF0> *</span><span class=cF5>DocCopy</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF1>start</span><span class=cF0>, </span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF1>end</span><span class=cF0>)
<a name="l123"></a>{</span><span class=cF2>//Copies start to end entry, including end points.</span><span class=cF0>
<a name="l124"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc2 = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l125"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l126"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ne;
<a name="l127"></a>
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0> != doc &amp;&amp; </span><span class=cF7>(</span><span class=cF1>start</span><span class=cF0>-&gt;last != </span><span class=cF1>end</span><span class=cF0> || </span><span class=cF1>end</span><span class=cF0> == doc</span><span class=cF7>)</span><span class=cF0>)
<a name="l129"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l130"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>doldoc</span><span class=cF0>.type_flags_data, </span><span class=cF1>start</span><span class=cF0>-&gt;type_u8</span><span class=cF7>)</span><span class=cF0>)
<a name="l132"></a> {
<a name="l133"></a> doc_ne = </span><span class=cF5>DocEntryCopy</span><span class=cF0>(doc2, </span><span class=cF1>start</span><span class=cF0>);
<a name="l134"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc2-&gt;head.last);
<a name="l135"></a> }
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0> == </span><span class=cF1>end</span><span class=cF0>)
<a name="l137"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l138"></a> </span><span class=cF1>start</span><span class=cF0> = </span><span class=cF1>start</span><span class=cF0>-&gt;next;
<a name="l139"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l140"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0> != doc);
<a name="l141"></a>
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l143"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l144"></a> </span><span class=cF1>return</span><span class=cF0> doc2;
<a name="l145"></a>}
</span></pre></body>
</html>