templeos-info/public/Wb/Adam/TaskSettings.HC.HTML

152 lines
13 KiB
HTML
Executable File

<!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;Task/Settings&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>CTaskSettings</span><span class=cF0> *</span><span class=cF5>SettingsPush</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> flags=0)
<a name="l4"></a>{</span><span class=cF2>//Typically, called at start of an application.</span><span class=cF0>
<a name="l5"></a></span><span class=cF2>//It saves many settings so they can be restored</span><span class=cF0>
<a name="l6"></a> </span><span class=cF2>//at the end of the application with </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l89"><span class=cF4>SettingsPop</span></a><span class=cF2>().</span><span class=cF0>
<a name="l7"></a>
<a name="l8"></a> </span><span class=cF9>CTaskSettings</span><span class=cF0> *tmpse;
<a name="l9"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l11"></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=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l12"></a> tmpse=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CTaskSettings</span><span class=cF7>)</span><span class=cF0>,task);
<a name="l13"></a> tmpse-&gt;cur_dir=</span><span class=cF5>DirCur</span><span class=cF0>(task,task);
<a name="l14"></a> tmpse-&gt;draw_it=task-&gt;draw_it;
<a name="l15"></a> </span><span class=cF5>GrPaletteGet</span><span class=cF0>(tmpse-&gt;palette);
<a name="l16"></a> tmpse-&gt;task_end_cb=task-&gt;task_end_cb;
<a name="l17"></a>
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>flags&amp;</span><span class=cF3>TSF_SAME_SONG</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse-&gt;song_task=task-&gt;song_task) {
<a name="l20"></a> </span><span class=cF5>Suspend</span><span class=cF0>(task-&gt;song_task);
<a name="l21"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l22"></a> }
<a name="l23"></a> task-&gt;song_task=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l24"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l25"></a>
<a name="l26"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse-&gt;animate_task=task-&gt;animate_task)
<a name="l27"></a> </span><span class=cF5>Suspend</span><span class=cF0>(task-&gt;animate_task);
<a name="l28"></a> task-&gt;animate_task=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l29"></a>
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (doc=</span><span class=cF5>DocPut</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>
<a name="l31"></a> tmpse-&gt;hide_cursor=!</span><span class=cF5>Bt</span><span class=cF0>(&amp;doc-&gt;flags,</span><span class=cF3>DOCf_HIDE_CURSOR</span><span class=cF0>);
<a name="l32"></a> tmpse-&gt;highlight_cursor=!</span><span class=cF5>Bt</span><span class=cF0>(&amp;doc-&gt;flags,</span><span class=cF3>DOCf_DONT_HIGHLIGHT_CURSOR</span><span class=cF0>);
<a name="l33"></a> tmpse-&gt;scroll=!</span><span class=cF5>Bt</span><span class=cF0>(&amp;doc-&gt;flags,</span><span class=cF3>DOCf_NO_SCROLL_BARS</span><span class=cF0>);
<a name="l34"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l35"></a>
<a name="l36"></a> tmpse-&gt;left=task-&gt;win_left;
<a name="l37"></a> tmpse-&gt;right=task-&gt;win_right;
<a name="l38"></a> tmpse-&gt;top=task-&gt;win_top;
<a name="l39"></a> tmpse-&gt;bottom=task-&gt;win_bottom;
<a name="l40"></a>
<a name="l41"></a> tmpse-&gt;scroll_x=task-&gt;scroll_x;
<a name="l42"></a> tmpse-&gt;scroll_y=task-&gt;scroll_y;
<a name="l43"></a> tmpse-&gt;scroll_z=task-&gt;scroll_z;
<a name="l44"></a>
<a name="l45"></a> tmpse-&gt;win_inhibit=task-&gt;win_inhibit;
<a name="l46"></a> tmpse-&gt;text_attr=task-&gt;text_attr;
<a name="l47"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(tmpse-&gt;task_title,task-&gt;task_title);
<a name="l48"></a> tmpse-&gt;title_src =task-&gt;title_src;
<a name="l49"></a> tmpse-&gt;border_attr=task-&gt;border_attr;
<a name="l50"></a> tmpse-&gt;border_src =task-&gt;border_src;
<a name="l51"></a> tmpse-&gt;border=!</span><span class=cF5>Bt</span><span class=cF0>(&amp;task-&gt;display_flags,</span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF0>);
<a name="l52"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cFB>ac</span><span class=cF0>.task</span><span class=cF7>)</span><span class=cF0>)
<a name="l53"></a> tmpse-&gt;autocomplete=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l54"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l55"></a> tmpse-&gt;autocomplete=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l56"></a>
<a name="l57"></a> tmpse-&gt;next=task-&gt;next_settings;
<a name="l58"></a> task-&gt;next_settings=tmpse;
<a name="l59"></a> </span><span class=cF1>return</span><span class=cF0> tmpse;
<a name="l60"></a>}
<a name="l61"></a>
<a name="l62"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SettingsPop2</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF9>CTaskSettings</span><span class=cF0> *tmpse)
<a name="l63"></a>{
<a name="l64"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
<a name="l65"></a>
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (doc=</span><span class=cF5>DocPut</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>
<a name="l67"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;doc-&gt;flags,</span><span class=cF3>DOCf_HIDE_CURSOR</span><span class=cF0>,!tmpse-&gt;hide_cursor);
<a name="l68"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;doc-&gt;flags,</span><span class=cF3>DOCf_DONT_HIGHLIGHT_CURSOR</span><span class=cF0>,!tmpse-&gt;highlight_cursor);
<a name="l69"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;doc-&gt;flags,</span><span class=cF3>DOCf_NO_SCROLL_BARS</span><span class=cF0>,!tmpse-&gt;scroll);
<a name="l70"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l71"></a>
<a name="l72"></a> </span><span class=cF5>WinBorder</span><span class=cF0>(tmpse-&gt;border,task);
<a name="l73"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(tmpse-&gt;left,tmpse-&gt;right,task);
<a name="l74"></a> </span><span class=cF5>WinVert</span><span class=cF0>(tmpse-&gt;top,tmpse-&gt;bottom,task);
<a name="l75"></a> task-&gt;scroll_x=tmpse-&gt;scroll_x;
<a name="l76"></a> task-&gt;scroll_y=tmpse-&gt;scroll_y;
<a name="l77"></a> task-&gt;scroll_z=tmpse-&gt;scroll_z;
<a name="l78"></a> task-&gt;win_inhibit=tmpse-&gt;win_inhibit;
<a name="l79"></a> task-&gt;text_attr=tmpse-&gt;text_attr;
<a name="l80"></a> task-&gt;border_attr=tmpse-&gt;border_attr;
<a name="l81"></a> task-&gt;border_src =tmpse-&gt;border_src;
<a name="l82"></a> task-&gt;title_src =tmpse-&gt;title_src;
<a name="l83"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(task-&gt;task_title,tmpse-&gt;task_title);
<a name="l84"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>(tmpse-&gt;autocomplete);
<a name="l85"></a> </span><span class=cF5>GrPaletteSet</span><span class=cF0>(tmpse-&gt;palette);
<a name="l86"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l87"></a>}
<a name="l88"></a>
<a name="l89"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SettingsPop</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> flags=0)
<a name="l90"></a>{</span><span class=cF2>//Typically, called at end of an application.</span><span class=cF0>
<a name="l91"></a> </span><span class=cF9>CTaskSettings</span><span class=cF0> *tmpse;
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l93"></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>)
<a name="l94"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l95"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse=task-&gt;next_settings) </span><span class=cF7>{</span><span class=cF0>
<a name="l96"></a> task-&gt;next_settings=tmpse-&gt;next;
<a name="l97"></a> </span><span class=cF5>Cd</span><span class=cF0>(tmpse-&gt;cur_dir);
<a name="l98"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpse-&gt;cur_dir);
<a name="l99"></a> task-&gt;draw_it=tmpse-&gt;draw_it;
<a name="l100"></a> task-&gt;task_end_cb=tmpse-&gt;task_end_cb;
<a name="l101"></a>
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;animate_task)
<a name="l103"></a> </span><span class=cF5>Kill</span><span class=cF0>(task-&gt;animate_task);
<a name="l104"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;animate_task=tmpse-&gt;animate_task)
<a name="l105"></a> </span><span class=cF5>Suspend</span><span class=cF0>(task-&gt;animate_task,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l106"></a>
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>flags&amp;</span><span class=cF3>TSF_SAME_SONG</span><span class=cF7>)</span><span class=cF0>) {
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;song_task)
<a name="l109"></a> </span><span class=cF5>Kill</span><span class=cF0>(task-&gt;song_task);
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;song_task=tmpse-&gt;song_task)
<a name="l111"></a> </span><span class=cF5>Suspend</span><span class=cF0>(task-&gt;song_task,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l112"></a> }
<a name="l113"></a>
<a name="l114"></a> </span><span class=cF5>SettingsPop2</span><span class=cF0>(task,tmpse); </span><span class=cF2>//Do it to get ress fast</span><span class=cF0>
<a name="l115"></a> </span><span class=cF5>Refresh</span><span class=cF0>(,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l116"></a> </span><span class=cF5>SettingsPop2</span><span class=cF0>(task,tmpse); </span><span class=cF2>//Redo in case was lost by old update</span><span class=cF0>
<a name="l117"></a>
<a name="l118"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpse);
<a name="l119"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l120"></a>}
</span></pre></body>
</html>