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

157 lines
15 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/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>DocRst</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="/Wb/Kernel/KernelA.HH.HTML#l953"><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),
<a name="l14"></a> unlock_doc2=</span><span class=cF5>DocLock</span><span class=cF0>(doc2);
<a name="l15"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e=doc-&gt;head.next,*doc_ne;
<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) </span><span class=cF7>{</span><span class=cF0>
<a name="l18"></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="l19"></a> doc_e-&gt;type&amp;=~</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l20"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l21"></a> doc_ne=</span><span class=cF5>DocEntryCopy</span><span class=cF0>(doc2,doc_e);
<a name="l22"></a> </span><span class=cF5>QueIns</span><span class=cF0>(doc_ne,doc2-&gt;head.last);
<a name="l23"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l24"></a> }
<a name="l25"></a> doc_e=doc_e-&gt;next;
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l27"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc2)
<a name="l28"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc2);
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l30"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l31"></a>}
<a name="l32"></a>
<a name="l33"></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="l34"></a>{</span><span class=cF2>//Remove sel entries and place on clip.</span><span class=cF0>
<a name="l35"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc2=</span><span class=cFB>sys_clip_doc</span><span class=cF0>;
<a name="l36"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc=</span><span class=cF5>DocLock</span><span class=cF0>(doc),
<a name="l37"></a> unlock_doc2=</span><span class=cF5>DocLock</span><span class=cF0>(doc2);
<a name="l38"></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="l39"></a> </span><span class=cF5>ClipDel</span><span class=cF0>;
<a name="l40"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) </span><span class=cF7>{</span><span class=cF0>
<a name="l41"></a> doc_e1=doc_e-&gt;next;
<a name="l42"></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="l43"></a> doc_e-&gt;type&amp;=~</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l44"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l45"></a> doc_ne=</span><span class=cF5>DocEntryCopy</span><span class=cF0>(doc2,doc_e);
<a name="l46"></a> </span><span class=cF5>QueIns</span><span class=cF0>(doc_ne,doc2-&gt;head.last);
<a name="l47"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc-&gt;cur_entry || doc_e==doc_e2)
<a name="l49"></a> doc_e2=doc_e-&gt;next;
<a name="l50"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc,doc_e);
<a name="l51"></a> }
<a name="l52"></a> doc_e=doc_e1;
<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_e2) </span><span class=cF7>{</span><span class=cF0>
<a name="l55"></a> doc-&gt;cur_entry=doc_e2;
<a name="l56"></a> doc-&gt;cur_col=doc_e2-&gt;min_col;
<a name="l57"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l58"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc,</span><span class=cF3>NULL</span><span class=cF0>);
<a name="l59"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc2)
<a name="l60"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc2);
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l62"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<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>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="l66"></a>{</span><span class=cF2>//Insert copy of clip at insert pt, cur_entry.</span><span class=cF0>
<a name="l67"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc2=</span><span class=cFB>sys_clip_doc</span><span class=cF0>;
<a name="l68"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc=</span><span class=cF5>DocLock</span><span class=cF0>(doc),
<a name="l69"></a> unlock_doc2=</span><span class=cF5>DocLock</span><span class=cF0>(doc2);
<a name="l70"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce=doc-&gt;cur_entry,*doc_e;
<a name="l71"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l72"></a> doc_e=doc2-&gt;head.next;
<a name="l73"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc2) {
<a name="l74"></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="l75"></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="l76"></a> doc_e=doc_e-&gt;next;
<a name="l77"></a> }
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l79"></a> </span><span class=cF5>DocInsDoc</span><span class=cF0>(doc,doc2);
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc2)
<a name="l81"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc2);
<a name="l82"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l83"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l84"></a>}
<a name="l85"></a>
<a name="l86"></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="l87"></a>{</span><span class=cF2>//Del start to end entry, including end points.</span><span class=cF0>
<a name="l88"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l89"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e1;
<a name="l90"></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="l91"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l92"></a> doc_e1=</span><span class=cF1>start</span><span class=cF0>-&gt;next;
<a name="l93"></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="l94"></a> doc-&gt;cur_entry=</span><span class=cF1>start</span><span class=cF0>-&gt;next;
<a name="l95"></a> doc-&gt;cur_col=doc-&gt;cur_entry-&gt;min_col;
<a name="l96"></a> }
<a name="l97"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc,</span><span class=cF1>start</span><span class=cF0>);
<a name="l98"></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="l99"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l100"></a> </span><span class=cF1>start</span><span class=cF0>=doc_e1;
<a name="l101"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0>!=doc);
<a name="l102"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc,</span><span class=cF3>NULL</span><span class=cF0>);
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l104"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l105"></a>}
<a name="l106"></a>
<a name="l107"></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="l108"></a>{</span><span class=cF2>//Copies start to end entry, including end points.</span><span class=cF0>
<a name="l109"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc2=</span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l110"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l111"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ne;
<a name="l112"></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="l113"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l114"></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="l115"></a> doc_ne=</span><span class=cF5>DocEntryCopy</span><span class=cF0>(doc2,</span><span class=cF1>start</span><span class=cF0>);
<a name="l116"></a> </span><span class=cF5>QueIns</span><span class=cF0>(doc_ne,doc2-&gt;head.last);
<a name="l117"></a> }
<a name="l118"></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="l119"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l120"></a> </span><span class=cF1>start</span><span class=cF0>=</span><span class=cF1>start</span><span class=cF0>-&gt;next;
<a name="l121"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0>!=doc);
<a name="l122"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l123"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l124"></a> </span><span class=cF1>return</span><span class=cF0> doc2;
<a name="l125"></a>}
</span></pre></body>
</html>