templeos-info/public/Wb/Apps/Psalmody/PsalmodyMain.HC.HTML

830 lines
80 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>define</span><span class=cF0> PSMR_FLAT -8
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> PSMR_SHARP -7
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> PSMR_TIE -6
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> PSMR_REST -5
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> PSMR_INS_NOTE -4
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> PSMR_DELETE_NOTE -3
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> PSMR_SET_WORD -2
<a name="l8"></a>
<a name="l9"></a></span><span class=cF1>F64</span><span class=cF0> PopUpDuration()
<a name="l10"></a>{
<a name="l11"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l12"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l13"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;$GREEN$$MU,\&quot;Set Word\&quot;,LE=PSMR_SET_WORD$\n&quot;</span><span class=cF0>
<a name="l14"></a> </span><span class=cF6>&quot;$MU,\&quot;Toggle Sharp\&quot;,LE=PSMR_SHARP$\n&quot;</span><span class=cF0>
<a name="l15"></a> </span><span class=cF6>&quot;$MU,\&quot;Toggle Flat\&quot;,LE=PSMR_FLAT$\n&quot;</span><span class=cF0>
<a name="l16"></a> </span><span class=cF6>&quot;$MU,\&quot;Toggle Tie\&quot;,LE=PSMR_TIE$\n&quot;</span><span class=cF0>
<a name="l17"></a> </span><span class=cF6>&quot;$MU,\&quot;Make Rest\&quot;,LE=PSMR_REST$\n&quot;</span><span class=cF0>
<a name="l18"></a> </span><span class=cF6>&quot;$MU,\&quot;Insert Note\&quot;,LE=PSMR_INS_NOTE$\n&quot;</span><span class=cF0>
<a name="l19"></a> </span><span class=cF6>&quot;$MU,\&quot;Delete Note\&quot;,LE=PSMR_DELETE_NOTE$\n\n&quot;</span><span class=cF0>);
<a name="l20"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;PSM_DURATIONS_NUM;i++)
<a name="l21"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;$MU,\&quot;%7.5f\&quot;,LE=%d$\n&quot;</span><span class=cF0>,psm_durations[i],i);
<a name="l22"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>&quot;\n$MU,\&quot;CANCEL\&quot;,LE=DOCM_CANCEL$\n&quot;</span><span class=cF0>);
<a name="l23"></a> i=</span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
<a name="l24"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l25"></a> </span><span class=cF1>return</span><span class=cF0> i;
<a name="l26"></a>}
<a name="l27"></a>
<a name="l28"></a></span><span class=cF1>U0</span><span class=cF0> PsmRightClick(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l29"></a>{
<a name="l30"></a> </span><span class=cF1>U8</span><span class=cF0> *st,*st2;
<a name="l31"></a> PsmNote *tmpn,*tmpn1;
<a name="l32"></a> </span><span class=cF9>I64</span><span class=cF0> i,old_doc_flags;
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocPut</span><span class=cF0>) old_doc_flags=</span><span class=cF5>DocPut</span><span class=cF0>-&gt;flags;
<a name="l34"></a> psm.cur_note=tmpn=PsmFindNote(x,y);
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn!=&amp;psm.head) </span><span class=cF7>{</span><span class=cF0>
<a name="l36"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_USER_TASK_DFT</span><span class=cF0>;
<a name="l37"></a> i=PopUpDuration;
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=i&lt;PSM_DURATIONS_NUM) {
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type==PSMT_NOTE)
<a name="l40"></a> tmpn-&gt;duration=i;
<a name="l41"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l42"></a> </span><span class=cF1>switch</span><span class=cF0> (i) </span><span class=cF7>{</span><span class=cF0>
<a name="l43"></a> </span><span class=cF1>case</span><span class=cF0> PSMR_REST:
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type==PSMT_NOTE)
<a name="l45"></a> tmpn-&gt;ona=0;
<a name="l46"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l47"></a> </span><span class=cF1>case</span><span class=cF0> PSMR_SHARP:
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type==PSMT_NOTE &amp;&amp; tmpn-&gt;ona) {
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Btr</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags,PSMf_FLAT</span><span class=cF7>)</span><span class=cF0>)
<a name="l50"></a> tmpn-&gt;ona++;
<a name="l51"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Btc</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags,PSMf_SHARP</span><span class=cF7>)</span><span class=cF0>)
<a name="l52"></a> tmpn-&gt;ona--;
<a name="l53"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l54"></a> tmpn-&gt;ona++;
<a name="l55"></a> }
<a name="l56"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l57"></a> </span><span class=cF1>case</span><span class=cF0> PSMR_FLAT:
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type==PSMT_NOTE &amp;&amp; tmpn-&gt;ona) {
<a name="l59"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Btr</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags,PSMf_SHARP</span><span class=cF7>)</span><span class=cF0>)
<a name="l60"></a> tmpn-&gt;ona--;
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Btc</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags,PSMf_FLAT</span><span class=cF7>)</span><span class=cF0>)
<a name="l62"></a> tmpn-&gt;ona++;
<a name="l63"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l64"></a> tmpn-&gt;ona--;
<a name="l65"></a> }
<a name="l66"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l67"></a> </span><span class=cF1>case</span><span class=cF0> PSMR_TIE:
<a name="l68"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type==PSMT_NOTE)
<a name="l69"></a> </span><span class=cF5>Btc</span><span class=cF0>(&amp;tmpn-&gt;flags,PSMf_TIE);
<a name="l70"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l71"></a> </span><span class=cF1>case</span><span class=cF0> PSMR_SET_WORD:
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type==PSMT_NOTE) {
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocPut</span><span class=cF0>) </span><span class=cF5>DocPut</span><span class=cF0>-&gt;flags&amp;=~</span><span class=cF3>DOCF_FORM</span><span class=cF0>;
<a name="l74"></a> </span><span class=cF1>if</span><span class=cF0> (PsmHasWords</span><span class=cF7>(</span><span class=cF0>tmpn-&gt;word</span><span class=cF7>)</span><span class=cF0>)
<a name="l75"></a> st2=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;\nWord(\&quot;%Q\&quot;):&quot;</span><span class=cF0>,tmpn-&gt;word);
<a name="l76"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l77"></a> st2=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;\nWord(\&quot;\&quot;):&quot;</span><span class=cF0>);
<a name="l78"></a> </span><span class=cF5>DocBottom</span><span class=cF0>;
<a name="l79"></a> st=</span><span class=cF5>GetStr</span><span class=cF0>(st2);
<a name="l80"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l81"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpn-&gt;word);
<a name="l82"></a> </span><span class=cF1>if</span><span class=cF0> (*st) </span><span class=cF7>{</span><span class=cF0>
<a name="l83"></a> tmpn-&gt;word=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%q&quot;</span><span class=cF0>,st);
<a name="l84"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l86"></a> tmpn-&gt;word=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>&quot; &quot;</span><span class=cF0>);
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocPut</span><span class=cF0>) </span><span class=cF5>DocPut</span><span class=cF0>-&gt;flags=</span><span class=cF5>DocPut</span><span class=cF0>-&gt;flags&amp;
<a name="l88"></a> ~</span><span class=cF3>DOCF_FORM</span><span class=cF0>|old_doc_flags&amp;</span><span class=cF3>DOCF_FORM</span><span class=cF0>;
<a name="l89"></a> }
<a name="l90"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l91"></a> </span><span class=cF1>case</span><span class=cF0> PSMR_INS_NOTE:
<a name="l92"></a> tmpn1=PsmNoteCopy(tmpn);
<a name="l93"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpn1,tmpn);
<a name="l94"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l95"></a> </span><span class=cF1>case</span><span class=cF0> PSMR_DELETE_NOTE:
<a name="l96"></a> psm.cur_note=tmpn-&gt;next;
<a name="l97"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpn);
<a name="l98"></a> PsmNoteDel(tmpn);
<a name="l99"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l100"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l101"></a> }
<a name="l102"></a> PsmSetWidth(psm.cur_note);
<a name="l103"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>-</span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0>
<a name="l104"></a> -</span><span class=cF3>WIF_SELF_BORDER</span><span class=cF0>-</span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0>-</span><span class=cF3>WIF_SELF_CTRLS</span><span class=cF0>;
<a name="l105"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l106"></a>}
<a name="l107"></a>
<a name="l108"></a></span><span class=cF1>U0</span><span class=cF0> PsmLeftClickPickNoteBox(</span><span class=cF9>I64</span><span class=cF0> duration)
<a name="l109"></a>{
<a name="l110"></a> </span><span class=cF9>I64</span><span class=cF0> o,n,msg_code,arg1,arg2;
<a name="l111"></a> PsmNote *tmpn,*tmpn1;
<a name="l112"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l113"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>);
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code==</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>) {
<a name="l115"></a> DrawDC2;
<a name="l116"></a> DrawNote(psm.dc2,arg1,arg2,duration);
<a name="l117"></a> }
<a name="l118"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>);
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&lt;13*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (arg1&gt;psm.head.last-&gt;x)
<a name="l121"></a> tmpn1=psm.head.last;
<a name="l122"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg1&lt;psm.head.next-&gt;x)
<a name="l123"></a> tmpn1=&amp;psm.head;
<a name="l124"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l125"></a> tmpn1=PsmFindNote(arg1-PSM_NOTE_SPACING/2,arg2);
<a name="l126"></a> tmpn=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PsmNote</span><span class=cF7>)</span><span class=cF0>);
<a name="l127"></a> tmpn-&gt;type=PSMT_NOTE;
<a name="l128"></a> arg2=arg2/4-15;
<a name="l129"></a> n=arg2%7;
<a name="l130"></a> o=4+arg2/-7;
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (n&lt;0) {
<a name="l132"></a> n+=7;
<a name="l133"></a> o++;
<a name="l134"></a> }
<a name="l135"></a> n=psm_note_inverse_map[n];
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (n&lt;3)
<a name="l137"></a> o--;
<a name="l138"></a> tmpn-&gt;ona=</span><span class=cF5>Note2Ona</span><span class=cF0>(n,o);
<a name="l139"></a> tmpn-&gt;duration=duration;
<a name="l140"></a> PsmSetWidth(tmpn);
<a name="l141"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpn,tmpn1);
<a name="l142"></a> psm.cur_note=tmpn-&gt;next;
<a name="l143"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l144"></a> DrawDC2;
<a name="l145"></a>}
<a name="l146"></a>
<a name="l147"></a></span><span class=cF1>U0</span><span class=cF0> PsmLeftClickPickMeterBox(</span><span class=cF9>I64</span><span class=cF0> top,</span><span class=cF9>I64</span><span class=cF0> bottom)
<a name="l148"></a>{
<a name="l149"></a> </span><span class=cF9>I64</span><span class=cF0> msg_code,arg1,arg2;
<a name="l150"></a> PsmNote *tmpn,*tmpn1;
<a name="l151"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l152"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>);
<a name="l153"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code==</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>) {
<a name="l154"></a> DrawDC2;
<a name="l155"></a> DrawTimeSignature(psm.dc2,arg1,arg2,top,bottom);
<a name="l156"></a> }
<a name="l157"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>);
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&lt;13*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l159"></a> </span><span class=cF1>if</span><span class=cF0> (arg1&gt;=psm.head.x)
<a name="l160"></a> tmpn1=psm.head.last;
<a name="l161"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg1&lt;psm.head.next-&gt;x)
<a name="l162"></a> tmpn1=&amp;psm.head;
<a name="l163"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l164"></a> tmpn1=PsmFindNote(arg1-PSM_NOTE_SPACING/2,arg2);
<a name="l165"></a> tmpn=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PsmNote</span><span class=cF7>)</span><span class=cF0>);
<a name="l166"></a> tmpn-&gt;type=PSMT_METER;
<a name="l167"></a> tmpn-&gt;meter_top=top;
<a name="l168"></a> tmpn-&gt;meter_bottom=bottom;
<a name="l169"></a> PsmSetWidth(tmpn);
<a name="l170"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpn,tmpn1);
<a name="l171"></a> psm.cur_note=tmpn-&gt;next;
<a name="l172"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l173"></a> DrawDC2;
<a name="l174"></a>}
<a name="l175"></a>
<a name="l176"></a></span><span class=cF1>U0</span><span class=cF0> PsmLeftClickStaffPtr(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l177"></a>{
<a name="l178"></a> PsmNote *tmpn,*tmpn1;
<a name="l179"></a> </span><span class=cF9>I64</span><span class=cF0> o,n,msg_code,arg1,arg2,n_original,o_original;
<a name="l180"></a> psm.cur_note=tmpn=PsmFindNote(x,y);
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn!=&amp;psm.head) </span><span class=cF7>{</span><span class=cF0>
<a name="l182"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type==PSMT_NOTE) {
<a name="l183"></a> o_original=</span><span class=cF5>Ona2Octave</span><span class=cF0>(tmpn-&gt;ona);
<a name="l184"></a> n_original=</span><span class=cF5>Ona2Note</span><span class=cF0> (tmpn-&gt;ona);
<a name="l185"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l186"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>);
<a name="l187"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code==</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>) {
<a name="l188"></a> tmpn1=PsmFindNote(arg1,arg2);
<a name="l189"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn1==&amp;psm.head || tmpn1==tmpn)
<a name="l190"></a> </span><span class=cF1>goto</span><span class=cF0> move_note;
<a name="l191"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l192"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpn1-&gt;word);
<a name="l193"></a> tmpn1-&gt;word=tmpn-&gt;word;
<a name="l194"></a> tmpn-&gt;word=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l195"></a> tmpn-&gt;ona=</span><span class=cF5>Note2Ona</span><span class=cF0>(n_original,o_original);
<a name="l196"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l197"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l198"></a>move_note:
<a name="l199"></a> arg2=arg2/4-15;
<a name="l200"></a> n=arg2%7;
<a name="l201"></a> o=4+arg2/-7;
<a name="l202"></a> </span><span class=cF1>if</span><span class=cF0> (n&lt;0) </span><span class=cF7>{</span><span class=cF0>
<a name="l203"></a> n+=7;
<a name="l204"></a> o++;
<a name="l205"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l206"></a> n=psm_note_inverse_map[n];
<a name="l207"></a> </span><span class=cF1>if</span><span class=cF0> (n&lt;3)
<a name="l208"></a> o--;
<a name="l209"></a> tmpn-&gt;ona=</span><span class=cF5>Note2Ona</span><span class=cF0>(n,o);
<a name="l210"></a> }
<a name="l211"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>);
<a name="l212"></a> PsmSetWidth(tmpn);
<a name="l213"></a> }
<a name="l214"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l215"></a>}
<a name="l216"></a>
<a name="l217"></a></span><span class=cF1>U0</span><span class=cF0> PsmLeftClickStaffBox(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l218"></a>{
<a name="l219"></a> </span><span class=cF9>I64</span><span class=cF0> msg_code,arg1,arg2;
<a name="l220"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l221"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>);
<a name="l222"></a> DrawDC2;
<a name="l223"></a> psm.dc2-&gt;color=</span><span class=cF3>ROPF_DITHER</span><span class=cF0>+</span><span class=cF3>WHITE</span><span class=cF0>&lt;&lt;16+</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l224"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(psm.dc2,x,y,arg1,arg2);
<a name="l225"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code==</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>) {
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (x&gt;arg1) </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;x,&amp;arg1);
<a name="l227"></a> PsmMarkSel(x,arg1,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l228"></a> }
<a name="l229"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>);
<a name="l230"></a> DrawDC2;
<a name="l231"></a>}
<a name="l232"></a>
<a name="l233"></a></span><span class=cF1>U0</span><span class=cF0> PsmLeftClick(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l234"></a>{
<a name="l235"></a> </span><span class=cF9>I64</span><span class=cF0> duration,top,bottom;
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (y&lt;13*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l237"></a> </span><span class=cF1>if</span><span class=cF0> (psm.tool==PSMTT_PTR_TOOL)
<a name="l238"></a> PsmLeftClickStaffPtr(x,y);
<a name="l239"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l240"></a> PsmLeftClickStaffBox(x,y);
<a name="l241"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l242"></a> duration=PsmGetPickNoteBoxDuration(x,y);
<a name="l243"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=duration&lt;PSM_DURATIONS_NUM)
<a name="l244"></a> PsmLeftClickPickNoteBox(duration);
<a name="l245"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (PsmGetPickMeterBox</span><span class=cF7>(</span><span class=cF0>x,y,&amp;top,&amp;bottom</span><span class=cF7>)</span><span class=cF0>)
<a name="l246"></a> PsmLeftClickPickMeterBox(top,bottom);
<a name="l247"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (PsmGetPickToolBox</span><span class=cF7>(</span><span class=cF0>x,y</span><span class=cF7>)</span><span class=cF0>)
<a name="l248"></a> DrawDC2;
<a name="l249"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l250"></a>}
<a name="l251"></a>
<a name="l252"></a></span><span class=cF1>U8</span><span class=cF0> PsmCvtDuration(</span><span class=cF1>F64</span><span class=cF0> d)
<a name="l253"></a>{
<a name="l254"></a> </span><span class=cF1>F64</span><span class=cF0> d1,d2;
<a name="l255"></a> </span><span class=cF9>I64</span><span class=cF0> j;
<a name="l256"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;PSM_DURATIONS_NUM;j++) </span><span class=cF7>{</span><span class=cF0>
<a name="l257"></a> d1=psm_durations[j];
<a name="l258"></a> d2=psm_durations[j+1];
<a name="l259"></a> </span><span class=cF1>if</span><span class=cF0> (d&lt;d1*d2/</span><span class=cF7>(</span><span class=cF0>d1+d2</span><span class=cF7>)</span><span class=cF0>)
<a name="l260"></a> </span><span class=cF1>return</span><span class=cF0> j;
<a name="l261"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l262"></a> </span><span class=cF1>return</span><span class=cF0> 0;
<a name="l263"></a>}
<a name="l264"></a>
<a name="l265"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_KEYS_NUM 20
<a name="l266"></a></span><span class=cF1>class</span><span class=cF0> PsmKey
<a name="l267"></a>{
<a name="l268"></a> </span><span class=cF1>U8</span><span class=cF0> x,w,h,ascii;
<a name="l269"></a>};
<a name="l270"></a>
<a name="l271"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_W_W 16
<a name="l272"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_W_H 36
<a name="l273"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_B_W 8
<a name="l274"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_B_H 20
<a name="l275"></a>
<a name="l276"></a>PsmKey psm_kbd[PSM_KEYS_NUM]={
<a name="l277"></a> </span><span class=cF7>{</span><span class=cF0> 2*PSM_W_W-4,PSM_B_W,PSM_B_H,</span><span class=cF6>'e'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l278"></a> </span><span class=cF7>{</span><span class=cF0> 3*PSM_W_W-4,PSM_B_W,PSM_B_H,</span><span class=cF6>'r'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l279"></a> </span><span class=cF7>{</span><span class=cF0> 4*PSM_W_W-4,PSM_B_W,PSM_B_H,</span><span class=cF6>'t'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l280"></a> </span><span class=cF7>{</span><span class=cF0> 6*PSM_W_W-4,PSM_B_W,PSM_B_H,</span><span class=cF6>'u'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l281"></a> </span><span class=cF7>{</span><span class=cF0> 7*PSM_W_W-4,PSM_B_W,PSM_B_H,</span><span class=cF6>'i'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l282"></a> </span><span class=cF7>{</span><span class=cF0> 9*PSM_W_W-4,PSM_B_W,PSM_B_H,</span><span class=cF6>'p'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l283"></a> </span><span class=cF7>{</span><span class=cF0>10*PSM_W_W-4,PSM_B_W,PSM_B_H,</span><span class=cF6>'['</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l284"></a> </span><span class=cF7>{</span><span class=cF0>11*PSM_W_W-4,PSM_B_W,PSM_B_H,</span><span class=cF6>']'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l285"></a>
<a name="l286"></a> </span><span class=cF7>{</span><span class=cF0> 0*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'a'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l287"></a> </span><span class=cF7>{</span><span class=cF0> 1*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'s'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l288"></a> </span><span class=cF7>{</span><span class=cF0> 2*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'d'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l289"></a> </span><span class=cF7>{</span><span class=cF0> 3*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'f'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l290"></a> </span><span class=cF7>{</span><span class=cF0> 4*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'g'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l291"></a> </span><span class=cF7>{</span><span class=cF0> 5*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'h'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l292"></a> </span><span class=cF7>{</span><span class=cF0> 6*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'j'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l293"></a> </span><span class=cF7>{</span><span class=cF0> 7*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'k'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l294"></a> </span><span class=cF7>{</span><span class=cF0> 8*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'l'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l295"></a> </span><span class=cF7>{</span><span class=cF0> 9*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>';'</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l296"></a> </span><span class=cF7>{</span><span class=cF0>10*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'\''</span><span class=cF0> </span><span class=cF7>}</span><span class=cF0>,
<a name="l297"></a> </span><span class=cF7>{</span><span class=cF0>11*PSM_W_W,PSM_W_W,PSM_W_H,</span><span class=cF6>'\n'</span><span class=cF7>}</span><span class=cF0>,
<a name="l298"></a>};
<a name="l299"></a>
<a name="l300"></a></span><span class=cF1>U0</span><span class=cF0> PsmDownKey(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l301"></a>{
<a name="l302"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l303"></a> PsmKey *o;
<a name="l304"></a> y-=</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>*13;
<a name="l305"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=y&lt;PSM_W_H) </span><span class=cF7>{</span><span class=cF0>
<a name="l306"></a> x-=16;
<a name="l307"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;PSM_KEYS_NUM;i++) {
<a name="l308"></a> o=&amp;psm_kbd[i];
<a name="l309"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;x&lt;=x&lt;o-&gt;x+o-&gt;w &amp;&amp; y&lt;o-&gt;h) </span><span class=cF7>{</span><span class=cF0>
<a name="l310"></a> </span><span class=cF5>Msg</span><span class=cF0>(</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>,o-&gt;ascii,0);
<a name="l311"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l312"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l313"></a> }
<a name="l314"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l315"></a>}
<a name="l316"></a>
<a name="l317"></a></span><span class=cF1>U0</span><span class=cF0> PsmUpKey(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l318"></a>{
<a name="l319"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l320"></a> PsmKey *o;
<a name="l321"></a> y-=</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>*13;
<a name="l322"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=y&lt;PSM_W_H) </span><span class=cF7>{</span><span class=cF0>
<a name="l323"></a> x-=16;
<a name="l324"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;PSM_KEYS_NUM;i++) {
<a name="l325"></a> o=&amp;psm_kbd[i];
<a name="l326"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;x&lt;=x&lt;o-&gt;x+o-&gt;w &amp;&amp; y&lt;o-&gt;h) </span><span class=cF7>{</span><span class=cF0>
<a name="l327"></a> </span><span class=cF5>Msg</span><span class=cF0>(</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>,o-&gt;ascii,0);
<a name="l328"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l329"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l330"></a> }
<a name="l331"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l332"></a>}
<a name="l333"></a>
<a name="l334"></a></span><span class=cF1>U0</span><span class=cF0> PsmPushMode(</span><span class=cF9>I64</span><span class=cF0> psm_octave)
<a name="l335"></a>{
<a name="l336"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>-</span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0>
<a name="l337"></a> -</span><span class=cF3>WIF_SELF_BORDER</span><span class=cF0>-</span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0>-</span><span class=cF3>WIF_SELF_CTRLS</span><span class=cF0>;
<a name="l338"></a> PsmMenu(psm_octave);
<a name="l339"></a>}
<a name="l340"></a>
<a name="l341"></a></span><span class=cF1>U0</span><span class=cF0> PsmPopMode()
<a name="l342"></a>{
<a name="l343"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_USER_TASK_DFT</span><span class=cF0>;
<a name="l344"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
<a name="l345"></a>}
<a name="l346"></a>
<a name="l347"></a>#</span><span class=cF1>define</span><span class=cF0> PSMF_CD 1
<a name="l348"></a>#</span><span class=cF1>define</span><span class=cF0> PSMF_INCOMPLETE 2
<a name="l349"></a>
<a name="l350"></a></span><span class=cF1>U0</span><span class=cF0> Psalmody(</span><span class=cF1>U8</span><span class=cF0> *dirname=</span><span class=cF6>&quot;~/Psalmody&quot;</span><span class=cF0>)
<a name="l351"></a>{
<a name="l352"></a> </span><span class=cF1>Bool</span><span class=cF0> was_playing,is_null=</span><span class=cF3>TRUE</span><span class=cF0>,was_null=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l353"></a> </span><span class=cF9>I64</span><span class=cF0> arg1,arg2,msg_code=0,col,ona=0,last_ona=0,
<a name="l354"></a> psm_octave=4,timeout_val,timeout_val2,old_doc_flags;
<a name="l355"></a> </span><span class=cF1>U8</span><span class=cF0> *filename=</span><span class=cF3>NULL</span><span class=cF0>,*st,*st2;
<a name="l356"></a> PsmNote *tmpn;
<a name="l357"></a> </span><span class=cF1>F64</span><span class=cF0> psm_duration=1.0,d,evt_time=</span><span class=cF5>tS</span><span class=cF0>,note_down_time=</span><span class=cF5>tS</span><span class=cF0>;
<a name="l358"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c=TempoNew;
<a name="l359"></a>
<a name="l360"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocPut</span><span class=cF0>) old_doc_flags=</span><span class=cF5>DocPut</span><span class=cF0>-&gt;flags;
<a name="l361"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
<a name="l362"></a>
<a name="l363"></a> </span><span class=cF5>MusicSettingsRst</span><span class=cF0>;
<a name="l364"></a> tempo_state.tempo=</span><span class=cF5>Round</span><span class=cF0>(TEMPO_RANGE*</span><span class=cF7>(</span><span class=cFB>music</span><span class=cF0>.tempo-0.5</span><span class=cF7>)</span><span class=cF0>/4.4);
<a name="l365"></a> tempo_state.stacatto=</span><span class=cF5>Round</span><span class=cF0>(TEMPO_RANGE*</span><span class=cF7>(</span><span class=cFB>music</span><span class=cF0>.stacatto_factor-0.12</span><span class=cF7>)</span><span class=cF0>/0.88);
<a name="l366"></a>
<a name="l367"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocPut</span><span class=cF0>) </span><span class=cF5>DocPut</span><span class=cF0>-&gt;flags|=</span><span class=cF3>DOCF_FORM</span><span class=cF0>;
<a name="l368"></a>
<a name="l369"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;psm,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PsmCtrl</span><span class=cF7>)</span><span class=cF0>);
<a name="l370"></a> psm.scrn_x=0;
<a name="l371"></a> psm.head.next=psm.head.last=&amp;psm.head;
<a name="l372"></a> psm.clip.next=psm.clip.last=&amp;psm.clip;
<a name="l373"></a> psm.cur_note=&amp;psm.head;
<a name="l374"></a> psm.dc2=</span><span class=cF5>DCAlias</span><span class=cF0>;
<a name="l375"></a>
<a name="l376"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l377"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l378"></a> </span><span class=cF6>&quot; New(,'.');&quot;</span><span class=cF0>
<a name="l379"></a> </span><span class=cF6>&quot; ChgDir(MSG_CMD,PSMF_CD);&quot;</span><span class=cF0>
<a name="l380"></a> </span><span class=cF6>&quot; Open(,CH_CTRLO);&quot;</span><span class=cF0>
<a name="l381"></a> </span><span class=cF6>&quot; SaveAs(,CH_CTRLA);&quot;</span><span class=cF0>
<a name="l382"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l383"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l384"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l385"></a> </span><span class=cF6>&quot;Edit {&quot;</span><span class=cF0>
<a name="l386"></a> </span><span class=cF6>&quot; Cut(,CH_CTRLX);&quot;</span><span class=cF0>
<a name="l387"></a> </span><span class=cF6>&quot; Copy(,CH_CTRLC);&quot;</span><span class=cF0>
<a name="l388"></a> </span><span class=cF6>&quot; Paste(,CH_CTRLV);&quot;</span><span class=cF0>
<a name="l389"></a> </span><span class=cF6>&quot; RightMenu(,'\n');&quot;</span><span class=cF0>
<a name="l390"></a> </span><span class=cF6>&quot; BackSpace(,CH_BACKSPACE);&quot;</span><span class=cF0>
<a name="l391"></a> </span><span class=cF6>&quot; DeleteNote(,,SC_DELETE);&quot;</span><span class=cF0>
<a name="l392"></a> </span><span class=cF6>&quot; ClearSong(,'.');&quot;</span><span class=cF0>
<a name="l393"></a> </span><span class=cF6>&quot; Left(,,SC_CURSOR_LEFT);&quot;</span><span class=cF0>
<a name="l394"></a> </span><span class=cF6>&quot; Right(,,SC_CURSOR_RIGHT);&quot;</span><span class=cF0>
<a name="l395"></a> </span><span class=cF6>&quot; GoBegin(,,0x4CB0000044B);&quot;</span><span class=cF0>
<a name="l396"></a> </span><span class=cF6>&quot; GoEnd(,,0x4CD0000044D);&quot;</span><span class=cF0>
<a name="l397"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l398"></a> </span><span class=cF6>&quot;Song {&quot;</span><span class=cF0>
<a name="l399"></a> </span><span class=cF6>&quot; Play(,'x');&quot;</span><span class=cF0>
<a name="l400"></a> </span><span class=cF6>&quot; Record(,'z');&quot;</span><span class=cF0>
<a name="l401"></a> </span><span class=cF6>&quot; Random(,',');&quot;</span><span class=cF0>
<a name="l402"></a> </span><span class=cF6>&quot; MarkIncomplete(MSG_CMD,PSMF_INCOMPLETE);&quot;</span><span class=cF0>
<a name="l403"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l404"></a> </span><span class=cF6>&quot;Snd {&quot;</span><span class=cF0>
<a name="l405"></a> </span><span class=cF6>&quot; Octave1(,'1');&quot;</span><span class=cF0>
<a name="l406"></a> </span><span class=cF6>&quot; Octave2(,'2');&quot;</span><span class=cF0>
<a name="l407"></a> </span><span class=cF6>&quot; Octave3(,'3');&quot;</span><span class=cF0>
<a name="l408"></a> </span><span class=cF6>&quot; Octave4(,'4');&quot;</span><span class=cF0>
<a name="l409"></a> </span><span class=cF6>&quot; Octave5(,'5');&quot;</span><span class=cF0>
<a name="l410"></a> </span><span class=cF6>&quot; Octave6(,'6');&quot;</span><span class=cF0>
<a name="l411"></a> </span><span class=cF6>&quot; Octave7(,'7');&quot;</span><span class=cF0>
<a name="l412"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l413"></a> </span><span class=cF6>&quot;Help {&quot;</span><span class=cF0>
<a name="l414"></a> </span><span class=cF6>&quot; Help(,,SC_F1);&quot;</span><span class=cF0>
<a name="l415"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l416"></a> );
<a name="l417"></a> psm.incomplete_entry=</span><span class=cF5>MenuEntryFind</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu,</span><span class=cF6>&quot;Song/MarkIncomplete&quot;</span><span class=cF0>);
<a name="l418"></a> psm.record_entry=</span><span class=cF5>MenuEntryFind</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu,</span><span class=cF6>&quot;Song/Record&quot;</span><span class=cF0>);
<a name="l419"></a>
<a name="l420"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l421"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
<a name="l422"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l423"></a>
<a name="l424"></a> dirname=</span><span class=cF5>StrNew</span><span class=cF0>(dirname);
<a name="l425"></a> PsmPushMode(psm_octave);
<a name="l426"></a> col=0;
<a name="l427"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;draw_it=&amp;</span><span class=cF5>DrawIt</span><span class=cF0>;
<a name="l428"></a>
<a name="l429"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l430"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
<a name="l431"></a> was_playing=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l432"></a>mo_start:
<a name="l433"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>ms</span><span class=cF0>.pos_text.y-</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_top&lt;18)
<a name="l434"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>|
<a name="l435"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>|
<a name="l436"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_CMD</span><span class=cF0>);
<a name="l437"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l438"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>|
<a name="l439"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_CMD</span><span class=cF0>);
<a name="l440"></a>mo_got_msg:
<a name="l441"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code==</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0> &amp;&amp; arg1==</span><span class=cF3>CH_SPACE</span><span class=cF0> &amp;&amp; !arg2) </span><span class=cF7>{</span><span class=cF0>
<a name="l442"></a></span><span class=cF2>//The Window Mgr sets the Doc cur_entry to a bttn</span><span class=cF0>
<a name="l443"></a> </span><span class=cF2>//and generates a &lt;SPACE&gt; when the Doc Bttns are clicked.</span><span class=cF0>
<a name="l444"></a> </span><span class=cF2>//This is so that kbd and mouse are the same for Doc's.</span><span class=cF0>
<a name="l445"></a> </span><span class=cF2>//We must now pass the &lt;SPACE&gt; onto the Doc hndlr.</span><span class=cF0>
<a name="l446"></a> </span><span class=cF5>PutKey</span><span class=cF0>(arg1,arg2);
<a name="l447"></a> </span><span class=cF1>goto</span><span class=cF0> mo_start;
<a name="l448"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l449"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l450"></a> </span><span class=cF5>DocBottom</span><span class=cF0>;
<a name="l451"></a> </span><span class=cF1>if</span><span class=cF0> (was_playing || </span><span class=cF5>DocPut</span><span class=cF0>-&gt;cur_entry-&gt;y&gt;=</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_height-2) {
<a name="l452"></a> PsmMenu(psm_octave);
<a name="l453"></a> col=0;
<a name="l454"></a> }
<a name="l455"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l456"></a>
<a name="l457"></a> ona=</span><span class=cF5>Note2Ona</span><span class=cF0>(3,psm_octave+1); </span><span class=cF2>//C</span><span class=cF0>
<a name="l458"></a> is_null=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l459"></a> </span><span class=cF1>switch</span><span class=cF0> (msg_code) </span><span class=cF7>{</span><span class=cF0>
<a name="l460"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_CMD</span><span class=cF0>:
<a name="l461"></a> PsmPopMode;
<a name="l462"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1) {
<a name="l463"></a> </span><span class=cF1>case</span><span class=cF0> PSMF_CD:
<a name="l464"></a> st2=dirname;
<a name="l465"></a> </span><span class=cF1>if</span><span class=cF0> (dirname=</span><span class=cF5>PopUpPickDir</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l466"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l467"></a> </span><span class=cF5>Free</span><span class=cF0>(filename);
<a name="l468"></a> filename=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l469"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l470"></a> dirname=st2;
<a name="l471"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l472"></a> </span><span class=cF1>case</span><span class=cF0> PSMF_INCOMPLETE:
<a name="l473"></a> psm.incomplete_entry-&gt;checked=!psm.incomplete_entry-&gt;checked;
<a name="l474"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l475"></a> }
<a name="l476"></a> PsmPushMode(psm_octave);
<a name="l477"></a> col=0;
<a name="l478"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l479"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>:
<a name="l480"></a> evt_time=</span><span class=cF5>tS</span><span class=cF0>;
<a name="l481"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0>&lt;=arg1&lt;=</span><span class=cF6>'9'</span><span class=cF0>) {
<a name="l482"></a> psm_octave=arg1-</span><span class=cF6>'0'</span><span class=cF0>;
<a name="l483"></a> PsmMenu(psm_octave);
<a name="l484"></a> col=0;
<a name="l485"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l486"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1) </span><span class=cF7>{</span><span class=cF0>
<a name="l487"></a> </span><span class=cF1>start</span><span class=cF0>:
<a name="l488"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'a'</span><span class=cF0>: ona-=8; </span><span class=cF1>break</span><span class=cF0>;
<a name="l489"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'s'</span><span class=cF0>: ona-=7; </span><span class=cF1>break</span><span class=cF0>;
<a name="l490"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'e'</span><span class=cF0>: ona-=6; </span><span class=cF1>break</span><span class=cF0>;
<a name="l491"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>: ona-=5; </span><span class=cF1>break</span><span class=cF0>;
<a name="l492"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'r'</span><span class=cF0>: ona-=4; </span><span class=cF1>break</span><span class=cF0>;
<a name="l493"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'f'</span><span class=cF0>: ona-=3; </span><span class=cF1>break</span><span class=cF0>;
<a name="l494"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>: ona-=2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l495"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'g'</span><span class=cF0>: ona--; </span><span class=cF1>break</span><span class=cF0>;
<a name="l496"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'h'</span><span class=cF0>: </span><span class=cF1>break</span><span class=cF0>;
<a name="l497"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'u'</span><span class=cF0>: ona++; </span><span class=cF1>break</span><span class=cF0>;
<a name="l498"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'j'</span><span class=cF0>: ona+=2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l499"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'i'</span><span class=cF0>: ona+=3; </span><span class=cF1>break</span><span class=cF0>;
<a name="l500"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'k'</span><span class=cF0>: ona+=4; </span><span class=cF1>break</span><span class=cF0>;
<a name="l501"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'l'</span><span class=cF0>: ona+=5; </span><span class=cF1>break</span><span class=cF0>;
<a name="l502"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'p'</span><span class=cF0>: ona+=6; </span><span class=cF1>break</span><span class=cF0>;
<a name="l503"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>';'</span><span class=cF0>: ona+=7; </span><span class=cF1>break</span><span class=cF0>;
<a name="l504"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'['</span><span class=cF0>: ona+=8; </span><span class=cF1>break</span><span class=cF0>;
<a name="l505"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\''</span><span class=cF0>: ona+=9; </span><span class=cF1>break</span><span class=cF0>;
<a name="l506"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>']'</span><span class=cF0>: ona+=10; </span><span class=cF1>break</span><span class=cF0>;
<a name="l507"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>: ona=0; </span><span class=cF1>break</span><span class=cF0>;
<a name="l508"></a> </span><span class=cF1>end</span><span class=cF0>:
<a name="l509"></a> is_null=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l510"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l511"></a>
<a name="l512"></a> </span><span class=cF1>case</span><span class=cF0> 0:
<a name="l513"></a> </span><span class=cF1>switch</span><span class=cF0> (arg2.u8[0]) {
<a name="l514"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
<a name="l515"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l516"></a> </span><span class=cF1>while</span><span class=cF0> (psm.cur_note-&gt;last!=&amp;psm.head) {
<a name="l517"></a> psm.cur_note=psm.cur_note-&gt;last;
<a name="l518"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note!=&amp;psm.head)
<a name="l519"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;psm.cur_note-&gt;flags,PSMf_SEL,arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l520"></a> }
<a name="l521"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l522"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note-&gt;last!=&amp;psm.head) {
<a name="l523"></a> psm.cur_note=psm.cur_note-&gt;last;
<a name="l524"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note!=&amp;psm.head)
<a name="l525"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;psm.cur_note-&gt;flags,PSMf_SEL,arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l526"></a> }
<a name="l527"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l528"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l529"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
<a name="l530"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l531"></a> </span><span class=cF1>while</span><span class=cF0> (psm.cur_note!=&amp;psm.head) {
<a name="l532"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note!=&amp;psm.head)
<a name="l533"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;psm.cur_note-&gt;flags,PSMf_SEL,arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l534"></a> psm.cur_note=psm.cur_note-&gt;next;
<a name="l535"></a> }
<a name="l536"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l537"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note!=&amp;psm.head) {
<a name="l538"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note!=&amp;psm.head)
<a name="l539"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;psm.cur_note-&gt;flags,PSMf_SEL,arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l540"></a> psm.cur_note=psm.cur_note-&gt;next;
<a name="l541"></a> }
<a name="l542"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l543"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l544"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_DELETE</span><span class=cF0>:
<a name="l545"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l546"></a> PsmCutToClip;
<a name="l547"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l548"></a> tmpn=psm.cur_note;
<a name="l549"></a> psm.cur_note=tmpn-&gt;next;
<a name="l550"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn!=&amp;psm.head) {
<a name="l551"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpn);
<a name="l552"></a> PsmNoteDel(tmpn);
<a name="l553"></a> }
<a name="l554"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l555"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l556"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_INS</span><span class=cF0>:
<a name="l557"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l558"></a> PsmPasteClip;
<a name="l559"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF0>)
<a name="l560"></a> PsmCopyToClip;
<a name="l561"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l562"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F1</span><span class=cF0>:
<a name="l563"></a> PsmPopMode;
<a name="l564"></a> </span><span class=cF5>PopUpEd</span><span class=cF0>(</span><span class=cF6>&quot;::/Apps/Psalmody/Help.DD.Z&quot;</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>);
<a name="l565"></a> PsmPushMode(psm_octave);
<a name="l566"></a> col=0;
<a name="l567"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l568"></a> }
<a name="l569"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l570"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>','</span><span class=cF0>:
<a name="l571"></a> </span><span class=cF5>Free</span><span class=cF0>(filename);
<a name="l572"></a> filename=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l573"></a> PsmPopMode;
<a name="l574"></a> </span><span class=cFB>music</span><span class=cF0>.octave=psm_octave;
<a name="l575"></a> </span><span class=cF1>if</span><span class=cF0> (st2=</span><span class=cF5>GodSongStr</span><span class=cF0>) {
<a name="l576"></a> PsmLoadSongStr(st2,&amp;psm_octave,&amp;psm_duration);
<a name="l577"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l578"></a> }
<a name="l579"></a> PsmPushMode(psm_octave);
<a name="l580"></a> col=0;
<a name="l581"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l582"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLO</span><span class=cF0>:
<a name="l583"></a> PsmPopMode;
<a name="l584"></a> </span><span class=cF5>RegOneTimePopUp</span><span class=cF0>(</span><span class=cF3>ARf_PSALMODY_JUKEBOX</span><span class=cF0>,
<a name="l585"></a> </span><span class=cF6>&quot;Sel a song and preview it.\n&quot;</span><span class=cF0>
<a name="l586"></a> </span><span class=cF6>&quot;$GREEN$&lt;SHIFT-ESC&gt;$FG$ to load it into Psalmody.\n\n&quot;</span><span class=cF0>
<a name="l587"></a> </span><span class=cF3>ST_WARN_ST</span><span class=cF0> </span><span class=cF6>&quot; Graphics and other embelishments\n&quot;</span><span class=cF0>
<a name="l588"></a> </span><span class=cF6>&quot;will be lost because Psalmody can't\n&quot;</span><span class=cF0>
<a name="l589"></a> </span><span class=cF6>&quot;parse HolyC programs completely.\n&quot;</span><span class=cF0>);
<a name="l590"></a> </span><span class=cF5>Free</span><span class=cF0>(filename);
<a name="l591"></a> filename=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l592"></a> JukeBox(dirname,&amp;filename);
<a name="l593"></a> </span><span class=cF1>if</span><span class=cF0> (filename) {
<a name="l594"></a> psm.scrn_x=0;
<a name="l595"></a> psm_duration=1.0;
<a name="l596"></a> psm_octave=4;
<a name="l597"></a> PsmSongDel(&amp;psm.head);
<a name="l598"></a> psm.cur_note=&amp;psm.head;
<a name="l599"></a> PsmLoadSong(filename,&amp;psm_octave,&amp;psm_duration);
<a name="l600"></a> psm.record_entry-&gt;checked=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l601"></a> psm.cur_note=psm.head.next;
<a name="l602"></a> }
<a name="l603"></a> PsmPushMode(psm_octave);
<a name="l604"></a> col=0;
<a name="l605"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l606"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLA</span><span class=cF0>:
<a name="l607"></a> PsmPopMode;
<a name="l608"></a> filename=PsmSaveSong(dirname,filename);
<a name="l609"></a> PsmPushMode(psm_octave);
<a name="l610"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l611"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLC</span><span class=cF0>:
<a name="l612"></a> PsmCopyToClip;
<a name="l613"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l614"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLV</span><span class=cF0>:
<a name="l615"></a> PsmPasteClip;
<a name="l616"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l617"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLX</span><span class=cF0>:
<a name="l618"></a> PsmCutToClip;
<a name="l619"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l620"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'.'</span><span class=cF0>:
<a name="l621"></a> PsmMenu(psm_octave);
<a name="l622"></a> col=0;
<a name="l623"></a> </span><span class=cF5>Free</span><span class=cF0>(filename);
<a name="l624"></a> filename=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l625"></a> psm_duration=1.0;
<a name="l626"></a> psm_octave=4;
<a name="l627"></a> PsmSongDel(&amp;psm.head);
<a name="l628"></a> psm.cur_note=&amp;psm.head;
<a name="l629"></a> psm.scrn_x=0;
<a name="l630"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l631"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l632"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note!=&amp;psm.head)
<a name="l633"></a> PsmRightClick(psm.cur_note-&gt;x,psm.cur_note-&gt;y);
<a name="l634"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l635"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'x'</span><span class=cF0>:
<a name="l636"></a> </span><span class=cF1>if</span><span class=cF0> (was_playing)
<a name="l637"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l638"></a> col=0;
<a name="l639"></a> psm.playing=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l640"></a> PsmMenu(psm_octave);
<a name="l641"></a> tmpn=psm.cur_note;
<a name="l642"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn!=&amp;psm.head) {
<a name="l643"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type!=PSMT_METER) </span><span class=cF7>{</span><span class=cF0>
<a name="l644"></a> timeout_val=</span><span class=cFB>cnts</span><span class=cF0>.jiffies;
<a name="l645"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>ms</span><span class=cF0>.pos_text.y-</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_top&lt;18)
<a name="l646"></a> msg_code=</span><span class=cF5>ScanMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|
<a name="l647"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_CMD</span><span class=cF0>);
<a name="l648"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l649"></a> msg_code=</span><span class=cF5>ScanMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|
<a name="l650"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_CMD</span><span class=cF0>);
<a name="l651"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code) {
<a name="l652"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l653"></a> psm.playing=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l654"></a> was_playing=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l655"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>ms</span><span class=cF0>.pos_text.y-</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_top&gt;=18 &amp;&amp;
<a name="l656"></a> msg_code==</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>)
<a name="l657"></a> </span><span class=cF1>goto</span><span class=cF0> mo_start;
<a name="l658"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l659"></a> </span><span class=cF1>goto</span><span class=cF0> mo_got_msg;
<a name="l660"></a> }
<a name="l661"></a> psm.cur_note=tmpn;
<a name="l662"></a> psm.scrn_x+=tmpn-&gt;x-0.33*</span><span class=cF3>GR_WIDTH</span><span class=cF0>;
<a name="l663"></a> </span><span class=cF1>if</span><span class=cF0> (PsmHasWords</span><span class=cF7>(</span><span class=cF0>tmpn-&gt;word</span><span class=cF7>)</span><span class=cF0>)
<a name="l664"></a> </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>,tmpn-&gt;word;
<a name="l665"></a> </span><span class=cF5>Snd</span><span class=cF0>(tmpn-&gt;ona);
<a name="l666"></a>
<a name="l667"></a> </span><span class=cFB>music</span><span class=cF0>.tempo=4.4*tempo_state.tempo/TEMPO_RANGE+0.5;
<a name="l668"></a> </span><span class=cFB>music</span><span class=cF0>.stacatto_factor=
<a name="l669"></a> 0.88*tempo_state.stacatto/TEMPO_RANGE+0.12;
<a name="l670"></a> d=</span><span class=cF3>JIFFY_FREQ</span><span class=cF0>*psm_durations[tmpn-&gt;duration]/</span><span class=cFB>music</span><span class=cF0>.tempo;
<a name="l671"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags,PSMf_TIE</span><span class=cF7>)</span><span class=cF0>) {
<a name="l672"></a> timeout_val+=d;
<a name="l673"></a> timeout_val2=timeout_val;
<a name="l674"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l675"></a> timeout_val+=d*</span><span class=cFB>music</span><span class=cF0>.stacatto_factor;
<a name="l676"></a> timeout_val2=timeout_val+
<a name="l677"></a> d*(1.0-</span><span class=cFB>music</span><span class=cF0>.stacatto_factor);
<a name="l678"></a> }
<a name="l679"></a> </span><span class=cF5>SleepUntil</span><span class=cF0>(timeout_val);
<a name="l680"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l681"></a> </span><span class=cF5>SleepUntil</span><span class=cF0>(timeout_val2);
<a name="l682"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l683"></a> tmpn=tmpn-&gt;next;
<a name="l684"></a> }
<a name="l685"></a> psm.cur_note=&amp;psm.head;
<a name="l686"></a> psm.scrn_x+=psm.cur_note-&gt;x-</span><span class=cF3>GR_WIDTH</span><span class=cF0>/2;
<a name="l687"></a> psm.playing=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l688"></a> PsmMenu(psm_octave);
<a name="l689"></a> col=0;
<a name="l690"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l691"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l692"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>:
<a name="l693"></a> tmpn=psm.cur_note-&gt;last;
<a name="l694"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn!=&amp;psm.head) {
<a name="l695"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpn);
<a name="l696"></a> PsmNoteDel(tmpn);
<a name="l697"></a> }
<a name="l698"></a> </span><span class=cF1>if</span><span class=cF0> (col) {
<a name="l699"></a> </span><span class=cF6>''</span><span class=cF0> </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>;
<a name="l700"></a> col--;
<a name="l701"></a> }
<a name="l702"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l703"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'z'</span><span class=cF0>:
<a name="l704"></a> </span><span class=cF1>if</span><span class=cF0> (psm.record_entry-&gt;checked)
<a name="l705"></a> psm.record_entry-&gt;checked=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l706"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l707"></a> psm.record_entry-&gt;checked=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l708"></a> psm_duration=1.0;
<a name="l709"></a> psm_octave=4;
<a name="l710"></a> psm.scrn_x=0;
<a name="l711"></a> }
<a name="l712"></a> PsmMenu(psm_octave);
<a name="l713"></a> col=0;
<a name="l714"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l715"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l716"></a> PsmPopMode;
<a name="l717"></a> filename=PsmSaveSong(dirname,filename);
<a name="l718"></a> PsmPushMode(psm_octave);
<a name="l719"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l720"></a> </span><span class=cF1>goto</span><span class=cF0> mo_done;
<a name="l721"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l722"></a> }
<a name="l723"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l724"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_UP</span><span class=cF0>:
<a name="l725"></a> evt_time=</span><span class=cF5>tS</span><span class=cF0>;
<a name="l726"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l727"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>:
<a name="l728"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&gt;18*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
<a name="l729"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_USER_TASK_DFT</span><span class=cF0>;
<a name="l730"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l731"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>-</span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0>-</span><span class=cF3>WIF_SELF_BORDER</span><span class=cF0>
<a name="l732"></a> -</span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0>-</span><span class=cF3>WIF_SELF_CTRLS</span><span class=cF0>;
<a name="l733"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l734"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>:
<a name="l735"></a> PsmDownKey(arg1,arg2);
<a name="l736"></a> PsmLeftClick(arg1,arg2);
<a name="l737"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l738"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>:
<a name="l739"></a> PsmUpKey(arg1,arg2);
<a name="l740"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l741"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l742"></a> PsmRightClick(arg1,arg2);
<a name="l743"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l744"></a> </span><span class=cF1>if</span><span class=cF0> (is_null)
<a name="l745"></a> ona=0;
<a name="l746"></a> </span><span class=cF1>if</span><span class=cF0> (ona!=last_ona || is_null!=was_null) </span><span class=cF7>{</span><span class=cF0>
<a name="l747"></a> </span><span class=cF1>if</span><span class=cF0> (!ona) {
<a name="l748"></a> </span><span class=cF1>if</span><span class=cF0> (is_null)
<a name="l749"></a> st=</span><span class=cF6>&quot;&quot;</span><span class=cF0>;
<a name="l750"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l751"></a> st=</span><span class=cF6>&quot;R&quot;</span><span class=cF0>;
<a name="l752"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l753"></a> st=</span><span class=cF5>LstSub</span><span class=cF0>(</span><span class=cF5>Ona2Note</span><span class=cF7>(</span><span class=cF0>ona</span><span class=cF7>)</span><span class=cF0>,psm_note_lst);
<a name="l754"></a> </span><span class=cF5>Snd</span><span class=cF0>(ona);
<a name="l755"></a> </span><span class=cF1>if</span><span class=cF0> (psm.record_entry-&gt;checked) {
<a name="l756"></a> </span><span class=cF1>if</span><span class=cF0> (!was_null) </span><span class=cF7>{</span><span class=cF0>
<a name="l757"></a> </span><span class=cFB>music</span><span class=cF0>.tempo=4.4*tempo_state.tempo/TEMPO_RANGE+0.5;
<a name="l758"></a> </span><span class=cFB>music</span><span class=cF0>.stacatto_factor=0.88*tempo_state.stacatto/TEMPO_RANGE+0.12;
<a name="l759"></a> tmpn-&gt;duration=PsmCvtDuration(
<a name="l760"></a> </span><span class=cFB>music</span><span class=cF0>.tempo*</span><span class=cF7>(</span><span class=cF0>evt_time-note_down_time</span><span class=cF7>)</span><span class=cF0>);
<a name="l761"></a> PsmSetWidth(tmpn);
<a name="l762"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpn,psm.cur_note-&gt;last);
<a name="l763"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l764"></a> </span><span class=cF1>if</span><span class=cF0> (!is_null) </span><span class=cF7>{</span><span class=cF0>
<a name="l765"></a> note_down_time=</span><span class=cF5>tS</span><span class=cF0>;
<a name="l766"></a> tmpn=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PsmNote</span><span class=cF7>)</span><span class=cF0>);
<a name="l767"></a> tmpn-&gt;type=PSMT_NOTE;
<a name="l768"></a> tmpn-&gt;ona=ona;
<a name="l769"></a> </span><span class=cF1>if</span><span class=cF0> (st[1]==</span><span class=cF6>'#'</span><span class=cF0>)
<a name="l770"></a> </span><span class=cF5>Bts</span><span class=cF0>(&amp;tmpn-&gt;flags,PSMf_SHARP);
<a name="l771"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l772"></a> }
<a name="l773"></a> last_ona=ona;
<a name="l774"></a> was_null=is_null;
<a name="l775"></a> </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>,st;
<a name="l776"></a> col+=</span><span class=cF5>StrLen</span><span class=cF0>(st);
<a name="l777"></a> </span><span class=cF1>if</span><span class=cF0> (col&gt;=</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_width-1) {
<a name="l778"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l779"></a> col=0;
<a name="l780"></a> }
<a name="l781"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l782"></a> }
<a name="l783"></a>mo_done:
<a name="l784"></a> </span><span class=cF5>GetMsg</span><span class=cF0>(,,1&lt;&lt;</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>);
<a name="l785"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
<a name="l786"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l787"></a> PsmPopMode;
<a name="l788"></a> PsmSongDel(&amp;psm.head);
<a name="l789"></a> PsmSongDel(&amp;psm.clip);
<a name="l790"></a> TempoDel(c);
<a name="l791"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
<a name="l792"></a> </span><span class=cF5>DCDel</span><span class=cF0>(psm.dc2);
<a name="l793"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l794"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l795"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocPut</span><span class=cF0>) </span><span class=cF5>DocPut</span><span class=cF0>-&gt;flags=</span><span class=cF5>DocPut</span><span class=cF0>-&gt;flags&amp;~</span><span class=cF3>DOCF_FORM</span><span class=cF0>|old_doc_flags&amp;</span><span class=cF3>DOCF_FORM</span><span class=cF0>;
<a name="l796"></a> </span><span class=cF5>Free</span><span class=cF0>(dirname);
<a name="l797"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l798"></a>}
</span></pre></body>
</html>