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

441 lines
37 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>
<a name="l2"></a> </span><span class=cFA>
<a name="l3"></a> &lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l4"></a> </span><span class=cFA>
<a name="l5"></a> &lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l6"></a> </span><span class=cFA>
<a name="l7"></a> &lt;3&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l8"></a> </span><span class=cFA>
<a name="l9"></a> &lt;4&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l10"></a> </span><span class=cFA>
<a name="l11"></a> &lt;5&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l12"></a> </span><span class=cFA>
<a name="l13"></a> &lt;6&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l14"></a>
<a name="l15"></a> </span><span class=cFA>
<a name="l16"></a> &lt;7&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l17"></a>
<a name="l18"></a> </span><span class=cFA>
<a name="l19"></a> &lt;8&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l20"></a>
<a name="l21"></a> </span><span class=cFA>
<a name="l22"></a> &lt;9&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l23"></a>
<a name="l24"></a> </span><span class=cFA>
<a name="l25"></a> &lt;10&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l26"></a>
<a name="l27"></a> </span><span class=cFA>
<a name="l28"></a> &lt;11&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l29"></a>
<a name="l30"></a>
<a name="l31"></a>
<a name="l32"></a>
<a name="l33"></a>
<a name="l34"></a>
<a name="l35"></a> </span><span class=cFA>
<a name="l36"></a> &lt;12&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l37"></a>
<a name="l38"></a>
<a name="l39"></a>
<a name="l40"></a> </span><span class=cFA>
<a name="l41"></a> &lt;13&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l42"></a> </span><span class=cFA>
<a name="l43"></a> &lt;14&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l44"></a> </span><span class=cFA>
<a name="l45"></a> &lt;15&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l46"></a>
<a name="l47"></a> </span><span class=cFA>
<a name="l48"></a> &lt;16&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l49"></a>
<a name="l50"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_NOTE_SPACING 9
<a name="l51"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_DURATIONS_NUM 12
<a name="l52"></a>
<a name="l53"></a></span><span class=cF1>F64</span><span class=cF0> psm_durations[PSM_DURATIONS_NUM+1]={
<a name="l54"></a>2*.25/3,.25,2*.5/3,.5,2.0/3.0,0.5*1.5,1.0,1.5,2.0,3.0,4.0,6.0,1000000.0};
<a name="l55"></a></span><span class=cF1>U8</span><span class=cF0> *psm_duration_lst=</span><span class=cF6>&quot;st\0s\0et\0e\0qt\0e.\0q\0q.\0h\0h.\0w\0w.\0&quot;</span><span class=cF0>;
<a name="l56"></a></span><span class=cF1>U8</span><span class=cF0> *psm_duration_imgs[PSM_DURATIONS_NUM]={
<a name="l57"></a> </span><span class=cFA>&lt;1&gt;</span><span class=cF0>,</span><span class=cFA>&lt;1&gt;</span><span class=cF0>,</span><span class=cFA>&lt;2&gt;</span><span class=cF0>,</span><span class=cFA>&lt;2&gt;</span><span class=cF0>,</span><span class=cFA>&lt;3&gt;</span><span class=cF0>,</span><span class=cFA>&lt;2&gt;</span><span class=cF0>,</span><span class=cFA>&lt;3&gt;</span><span class=cF0>,</span><span class=cFA>&lt;3&gt;</span><span class=cF0>,</span><span class=cFA>&lt;4&gt;</span><span class=cF0>,</span><span class=cFA>&lt;4&gt;</span><span class=cF0>,</span><span class=cFA>&lt;5&gt;</span><span class=cF0>,</span><span class=cFA>&lt;5&gt;</span><span class=cF0>};
<a name="l58"></a></span><span class=cF1>Bool</span><span class=cF0> psm_triplet_durations[PSM_DURATIONS_NUM]={</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>,
<a name="l59"></a> </span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>};
<a name="l60"></a>
<a name="l61"></a></span><span class=cF1>Bool</span><span class=cF0> PsmBlink()
<a name="l62"></a>{
<a name="l63"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0> || psm.playing)
<a name="l64"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l65"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l66"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l67"></a>}
<a name="l68"></a>
<a name="l69"></a></span><span class=cF1>Bool</span><span class=cF0> PsmHasWords(</span><span class=cF1>U8</span><span class=cF0> *st)
<a name="l70"></a>{
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (st &amp;&amp; *st &amp;&amp; </span><span class=cF7>(</span><span class=cF5>StrLen</span><span class=cF0>(st)&gt;1 || *st!=</span><span class=cF3>CH_SPACE</span><span class=cF0> &amp;&amp; *st!=</span><span class=cF3>CH_SHIFT_SPACE</span><span class=cF7>)</span><span class=cF0>)
<a name="l72"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l73"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l74"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l75"></a>}
<a name="l76"></a>
<a name="l77"></a></span><span class=cF1>Bool</span><span class=cF0> PsmIsDotted(</span><span class=cF9>I64</span><span class=cF0> duration)
<a name="l78"></a>{
<a name="l79"></a> </span><span class=cF1>U8</span><span class=cF0> *st=</span><span class=cF5>LstSub</span><span class=cF0>(duration,psm_duration_lst);
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (st[1]==</span><span class=cF6>'.'</span><span class=cF0>)
<a name="l81"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l82"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l83"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l84"></a>}
<a name="l85"></a>
<a name="l86"></a></span><span class=cF1>U0</span><span class=cF0> PsmMarkSel(</span><span class=cF9>I64</span><span class=cF0> x1,</span><span class=cF9>I64</span><span class=cF0> x2,</span><span class=cF1>Bool</span><span class=cF0> sel)
<a name="l87"></a>{
<a name="l88"></a> PsmNote *tmpn=psm.head.next;
<a name="l89"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn!=&amp;psm.head) </span><span class=cF7>{</span><span class=cF0>
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (sel) {
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (x1&lt;=tmpn-&gt;x&lt;=x2)
<a name="l92"></a> tmpn-&gt;flags|=PSMF_SEL;
<a name="l93"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l94"></a> tmpn-&gt;flags&amp;=~PSMF_SEL;
<a name="l95"></a> tmpn=tmpn-&gt;next;
<a name="l96"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l97"></a>}
<a name="l98"></a>
<a name="l99"></a></span><span class=cF1>U0</span><span class=cF0> PsmSetWidth(PsmNote *tmpn)
<a name="l100"></a>{
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type==PSMT_METER)
<a name="l102"></a> tmpn-&gt;width=12;
<a name="l103"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l104"></a> tmpn-&gt;width=PSM_NOTE_SPACING;
<a name="l105"></a> </span><span class=cF1>if</span><span class=cF0> (PsmIsDotted</span><span class=cF7>(</span><span class=cF0>tmpn-&gt;duration</span><span class=cF7>)</span><span class=cF0>)
<a name="l106"></a> tmpn-&gt;width+=PSM_NOTE_SPACING/2;
<a name="l107"></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_SHARP</span><span class=cF7>)</span><span class=cF0> || </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags,PSMf_FLAT</span><span class=cF7>)</span><span class=cF0>)
<a name="l108"></a> tmpn-&gt;width+=PSM_NOTE_SPACING;
<a name="l109"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l110"></a>}
<a name="l111"></a>
<a name="l112"></a></span><span class=cF1>U0</span><span class=cF0> PsmSetOctave(</span><span class=cF9>I64</span><span class=cF0> octave)
<a name="l113"></a>{
<a name="l114"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l115"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>];
<a name="l116"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
<a name="l117"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i&lt;=7;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l118"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;Snd/Octave%d&quot;</span><span class=cF0>,i);
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse=</span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu,buf</span><span class=cF7>)</span><span class=cF0>) {
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (i==octave)
<a name="l121"></a> tmpse-&gt;checked=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l122"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l123"></a> tmpse-&gt;checked=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l124"></a> }
<a name="l125"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l126"></a>}
<a name="l127"></a>
<a name="l128"></a></span><span class=cF1>U0</span><span class=cF0> DrawNote(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> duration)
<a name="l129"></a>{
<a name="l130"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=duration&lt;=PSM_DURATIONS_NUM) </span><span class=cF7>{</span><span class=cF0>
<a name="l131"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,x,y,0,psm_duration_imgs[duration]);
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (psm_triplet_durations[duration])
<a name="l133"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,x,y,0,</span><span class=cFA>&lt;16&gt;</span><span class=cF0>);
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (PsmIsDotted</span><span class=cF7>(</span><span class=cF0>duration</span><span class=cF7>)</span><span class=cF0>)
<a name="l135"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,x,y,0,</span><span class=cFA>&lt;15&gt;</span><span class=cF0>);
<a name="l136"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l137"></a>}
<a name="l138"></a>
<a name="l139"></a></span><span class=cF1>U0</span><span class=cF0> DrawTimeSignature(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> top,</span><span class=cF9>I64</span><span class=cF0> bottom)
<a name="l140"></a>{
<a name="l141"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,x,y,</span><span class=cF6>&quot;%d&quot;</span><span class=cF0>,top);
<a name="l142"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,x,y+</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>,</span><span class=cF6>&quot;%d&quot;</span><span class=cF0>,bottom);
<a name="l143"></a>}
<a name="l144"></a>
<a name="l145"></a></span><span class=cF1>U0</span><span class=cF0> PsmRecalcNoteXY()
<a name="l146"></a>{
<a name="l147"></a> </span><span class=cF1>F64</span><span class=cF0> measure_len=4,measure_left=measure_len;
<a name="l148"></a> PsmNote *tmpn=psm.head.next;
<a name="l149"></a> </span><span class=cF9>I64</span><span class=cF0> x=8-psm.scrn_x,ona,note,octave;
<a name="l150"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l151"></a> tmpn-&gt;x=x;
<a name="l152"></a> tmpn-&gt;y=50;
<a name="l153"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn==&amp;psm.head)
<a name="l154"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l155"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l156"></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="l157"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;ona) {
<a name="l158"></a> ona=tmpn-&gt;ona;
<a name="l159"></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_SHARP</span><span class=cF7>)</span><span class=cF0>)
<a name="l160"></a> ona--;
<a name="l161"></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_FLAT</span><span class=cF7>)</span><span class=cF0>)
<a name="l162"></a> ona++;
<a name="l163"></a> octave=</span><span class=cF5>Ona2Octave</span><span class=cF0>(ona);
<a name="l164"></a> note =</span><span class=cF5>Ona2Note</span><span class=cF0> (ona);
<a name="l165"></a> note=</span><span class=cFB>music</span><span class=cF0>.note_map[*</span><span class=cF5>LstSub</span><span class=cF0>(note,psm_note_lst)-</span><span class=cF6>'A'</span><span class=cF0>];
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (note&lt;3)
<a name="l167"></a> octave++;
<a name="l168"></a> tmpn-&gt;y=(15+</span><span class=cF7>(</span><span class=cF0>psm_note_map[note]-7*(octave-4)</span><span class=cF7>)</span><span class=cF0>)*4;
<a name="l169"></a> }
<a name="l170"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l171"></a> x+=tmpn-&gt;width;
<a name="l172"></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="l173"></a> measure_len=tmpn-&gt;meter_top*4.0/tmpn-&gt;meter_bottom;
<a name="l174"></a> measure_left=0;
<a name="l175"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l176"></a> measure_left-=psm_durations[tmpn-&gt;duration];
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (measure_left&lt;0.001) </span><span class=cF7>{</span><span class=cF0>
<a name="l178"></a> x+=PSM_NOTE_SPACING;
<a name="l179"></a> measure_left=measure_len;
<a name="l180"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l181"></a> }
<a name="l182"></a> tmpn=tmpn-&gt;next;
<a name="l183"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l184"></a>}
<a name="l185"></a>
<a name="l186"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawIt</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF9>CDC</span><span class=cF0> *dc)
<a name="l187"></a>{
<a name="l188"></a> PsmNote *tmpn;
<a name="l189"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,
<a name="l190"></a> w=task-&gt;pix_width;
<a name="l191"></a> </span><span class=cF1>F64</span><span class=cF0> measure_len=4,measure_left=measure_len;
<a name="l192"></a>
<a name="l193"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l194"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i&lt;6;i++)
<a name="l195"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,0,i*8,w,i*8);
<a name="l196"></a> </span><span class=cF1>for</span><span class=cF0> (i=7;i&lt;12;i++)
<a name="l197"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,0,i*8,w,i*8);
<a name="l198"></a>
<a name="l199"></a> PsmRecalcNoteXY;
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note-&gt;x&lt;64) </span><span class=cF7>{</span><span class=cF0>
<a name="l201"></a> psm.scrn_x-=128;
<a name="l202"></a> PsmRecalcNoteXY;
<a name="l203"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note-&gt;x&gt;=</span><span class=cF3>GR_WIDTH</span><span class=cF0>-64) </span><span class=cF7>{</span><span class=cF0>
<a name="l205"></a> psm.scrn_x+=128;
<a name="l206"></a> PsmRecalcNoteXY;
<a name="l207"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l208"></a>
<a name="l209"></a> tmpn=psm.head.next;
<a name="l210"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn!=&amp;psm.head) </span><span class=cF7>{</span><span class=cF0>
<a name="l211"></a> x=tmpn-&gt;x;
<a name="l212"></a> y=tmpn-&gt;y;
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (measure_left&lt;0.001) {
<a name="l214"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l215"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,x-PSM_NOTE_SPACING,8,x-PSM_NOTE_SPACING,11*8);
<a name="l216"></a> measure_left=measure_len;
<a name="l217"></a> }
<a name="l218"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type==PSMT_METER) {
<a name="l219"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn==psm.cur_note &amp;&amp; PsmBlink)
<a name="l220"></a> dc-&gt;color=</span><span class=cF3>BROWN</span><span class=cF0>;
<a name="l221"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l222"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l223"></a> DrawTimeSignature(dc,x,5*8,tmpn-&gt;meter_top,tmpn-&gt;meter_bottom);
<a name="l224"></a> measure_len=tmpn-&gt;meter_top*4.0/tmpn-&gt;meter_bottom;
<a name="l225"></a> measure_left=0;
<a name="l226"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l227"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn==psm.cur_note &amp;&amp; PsmBlink) </span><span class=cF7>{</span><span class=cF0>
<a name="l228"></a> dc-&gt;color=</span><span class=cF3>BROWN</span><span class=cF0>;
<a name="l229"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,x+8,y,</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>,tmpn-&gt;word);
<a name="l230"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;flags&amp;PSMF_SEL)
<a name="l231"></a> dc-&gt;color=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l232"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;ona)
<a name="l234"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l235"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l236"></a> dc-&gt;color=</span><span class=cF3>LTGRAY</span><span class=cF0>;
<a name="l237"></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="l238"></a> dc-&gt;color=</span><span class=cF3>GREEN</span><span class=cF0>;
<a name="l239"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l240"></a> DrawNote(dc,x,y,tmpn-&gt;duration);
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (PsmIsDotted</span><span class=cF7>(</span><span class=cF0>tmpn-&gt;duration</span><span class=cF7>)</span><span class=cF0>)
<a name="l242"></a> x+=PSM_NOTE_SPACING/2;
<a name="l243"></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_SHARP</span><span class=cF7>)</span><span class=cF0>)
<a name="l244"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,x,y,0,</span><span class=cFA>&lt;13&gt;</span><span class=cF0>);
<a name="l245"></a> </span><span class=cF1>else</span><span class=cF0> </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_FLAT</span><span class=cF7>)</span><span class=cF0>)
<a name="l246"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,x,y,0,</span><span class=cFA>&lt;14&gt;</span><span class=cF0>);
<a name="l247"></a> measure_left-=psm_durations[tmpn-&gt;duration];
<a name="l248"></a> }
<a name="l249"></a> tmpn=tmpn-&gt;next;
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l251"></a>
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note==&amp;psm.head &amp;&amp; PsmBlink)
<a name="l253"></a> dc-&gt;color=</span><span class=cF3>BROWN</span><span class=cF0>;
<a name="l254"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l255"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l256"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,psm.head.x,50,0,</span><span class=cFA>&lt;12&gt;</span><span class=cF0>);
<a name="l257"></a>}
<a name="l258"></a>
<a name="l259"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_NOTE_BOX_X 220
<a name="l260"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_NOTE_BOX_Y (13*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>+14)
<a name="l261"></a></span><span class=cF1>U0</span><span class=cF0> PsmSetPickNoteBoxX(</span><span class=cF9>I64</span><span class=cF0> duration,</span><span class=cF9>I64</span><span class=cF0> *x)
<a name="l262"></a>{
<a name="l263"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l264"></a> *x=PSM_NOTE_BOX_X;
<a name="l265"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;duration;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l266"></a> </span><span class=cF1>if</span><span class=cF0> (PsmIsDotted</span><span class=cF7>(</span><span class=cF0>i</span><span class=cF7>)</span><span class=cF0>)
<a name="l267"></a> *x+=PSM_NOTE_SPACING/2;
<a name="l268"></a> *x+=PSM_NOTE_SPACING+4;
<a name="l269"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l270"></a>}
<a name="l271"></a>
<a name="l272"></a></span><span class=cF9>I64</span><span class=cF0> PsmGetPickNoteBoxDuration(</span><span class=cF9>I64</span><span class=cF0> xx,</span><span class=cF9>I64</span><span class=cF0> yy)
<a name="l273"></a>{
<a name="l274"></a> </span><span class=cF9>I64</span><span class=cF0> i,x1,x2;
<a name="l275"></a> </span><span class=cF1>if</span><span class=cF0> (PSM_NOTE_BOX_Y-14&lt;=yy&lt;PSM_NOTE_BOX_Y+6) </span><span class=cF7>{</span><span class=cF0>
<a name="l276"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;PSM_DURATIONS_NUM;i++) {
<a name="l277"></a> PsmSetPickNoteBoxX(i,&amp;x1);
<a name="l278"></a> PsmSetPickNoteBoxX(i+1,&amp;x2);
<a name="l279"></a> </span><span class=cF1>if</span><span class=cF0> (x1&lt;=xx+PSM_NOTE_SPACING/2&lt;x2)
<a name="l280"></a> </span><span class=cF1>return</span><span class=cF0> i;
<a name="l281"></a> }
<a name="l282"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l283"></a> </span><span class=cF1>return</span><span class=cF0> -1;
<a name="l284"></a>}
<a name="l285"></a>
<a name="l286"></a></span><span class=cF1>U0</span><span class=cF0> DrawPickNoteBox()
<a name="l287"></a>{
<a name="l288"></a> </span><span class=cF9>I64</span><span class=cF0> i,x;
<a name="l289"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;PSM_DURATIONS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l290"></a> PsmSetPickNoteBoxX(i,&amp;x);
<a name="l291"></a> </span><span class=cF1>if</span><span class=cF0> (PsmIsDotted</span><span class=cF7>(</span><span class=cF0>i</span><span class=cF7>)</span><span class=cF0>)
<a name="l292"></a> psm.dc2-&gt;color=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l293"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (psm_triplet_durations[i])
<a name="l294"></a> psm.dc2-&gt;color=</span><span class=cF3>LTRED</span><span class=cF0>;
<a name="l295"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l296"></a> psm.dc2-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l297"></a> DrawNote(psm.dc2,x,PSM_NOTE_BOX_Y,i);
<a name="l298"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l299"></a>}
<a name="l300"></a>
<a name="l301"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_TOOLS_X 450
<a name="l302"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_TOOLS_Y 13*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>
<a name="l303"></a>
<a name="l304"></a></span><span class=cF1>U0</span><span class=cF0> DrawPickTools()
<a name="l305"></a>{
<a name="l306"></a> </span><span class=cF1>if</span><span class=cF0> (psm.tool==PSMTT_BOX_TOOL)
<a name="l307"></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>RED</span><span class=cF0>;
<a name="l308"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l309"></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="l310"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(psm.dc2,PSM_TOOLS_X,PSM_TOOLS_Y,PSM_TOOLS_X+10,PSM_TOOLS_Y+10);
<a name="l311"></a>
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (psm.tool==PSMTT_PTR_TOOL)
<a name="l313"></a> psm.dc2-&gt;color=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l314"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l315"></a> psm.dc2-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l316"></a> (*</span><span class=cFB>gr</span><span class=cF0>.fp_draw_ms)(psm.dc2,PSM_TOOLS_X+15,PSM_TOOLS_Y);
<a name="l317"></a> psm.dc2-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l318"></a>}
<a name="l319"></a>
<a name="l320"></a></span><span class=cF1>Bool</span><span class=cF0> PsmGetPickToolBox(</span><span class=cF9>I64</span><span class=cF0> xx,</span><span class=cF9>I64</span><span class=cF0> yy)
<a name="l321"></a>{
<a name="l322"></a> </span><span class=cF1>if</span><span class=cF0> (PSM_TOOLS_X&lt;=xx&lt;PSM_TOOLS_X+27 &amp;&amp; PSM_TOOLS_Y&lt;=yy&lt;PSM_TOOLS_Y+15) </span><span class=cF7>{</span><span class=cF0>
<a name="l323"></a> PsmMarkSel(0,0,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l324"></a> </span><span class=cF1>if</span><span class=cF0> (xx&lt;PSM_TOOLS_X+13)
<a name="l325"></a> psm.tool=PSMTT_BOX_TOOL;
<a name="l326"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l327"></a> psm.tool=PSMTT_PTR_TOOL;
<a name="l328"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l329"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l330"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l331"></a>}
<a name="l332"></a>
<a name="l333"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_METERS_NUM 7
<a name="l334"></a></span><span class=cF9>I64</span><span class=cF0> meter_tops[PSM_METERS_NUM] ={2,3,4,5,6,7,9},
<a name="l335"></a> meter_bottoms[PSM_METERS_NUM]={4,4,4,4,8,8,8};
<a name="l336"></a>
<a name="l337"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_METER_X 485
<a name="l338"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_METER_Y 13*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>
<a name="l339"></a>#</span><span class=cF1>define</span><span class=cF0> PSM_METER_W 12
<a name="l340"></a></span><span class=cF1>Bool</span><span class=cF0> PsmGetPickMeterBox(</span><span class=cF9>I64</span><span class=cF0> xx,</span><span class=cF9>I64</span><span class=cF0> yy,</span><span class=cF9>I64</span><span class=cF0> *top,</span><span class=cF9>I64</span><span class=cF0> *bottom)
<a name="l341"></a>{
<a name="l342"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l343"></a> </span><span class=cF1>if</span><span class=cF0> (PSM_METER_X&lt;=xx&lt;PSM_METER_X+PSM_METER_W*PSM_METERS_NUM &amp;&amp;
<a name="l344"></a> PSM_METER_Y&lt;=yy&lt;PSM_METER_Y+2*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l345"></a> i=(xx-PSM_METER_X)/PSM_METER_W;
<a name="l346"></a> *top=meter_tops[i];
<a name="l347"></a> *bottom=meter_bottoms[i];
<a name="l348"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l349"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l350"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l351"></a>}
<a name="l352"></a>
<a name="l353"></a></span><span class=cF1>U0</span><span class=cF0> DrawPickMeterBox()
<a name="l354"></a>{
<a name="l355"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l356"></a> psm.dc2-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l357"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;PSM_METERS_NUM;i++)
<a name="l358"></a> DrawTimeSignature(psm.dc2,PSM_METER_X+i*PSM_METER_W,PSM_METER_Y,
<a name="l359"></a> meter_tops[i],meter_bottoms[i]);
<a name="l360"></a>}
<a name="l361"></a>
<a name="l362"></a></span><span class=cF1>U0</span><span class=cF0> DrawDC2()
<a name="l363"></a>{
<a name="l364"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
<a name="l365"></a> DrawPickNoteBox;
<a name="l366"></a> DrawPickMeterBox;
<a name="l367"></a> DrawPickTools;
<a name="l368"></a>}
<a name="l369"></a>
<a name="l370"></a></span><span class=cFA>
<a name="l371"></a>&lt;17&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l372"></a>
<a name="l373"></a>
<a name="l374"></a>
<a name="l375"></a>
<a name="l376"></a>
<a name="l377"></a></span><span class=cF1>U0</span><span class=cF0> PsmMenu(</span><span class=cF9>I64</span><span class=cF0> psm_octave)
<a name="l378"></a>{
<a name="l379"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l380"></a> </span><span class=cF6>&quot;$BG,WHITE$$FD,GREEN$$CM,0,12$\n&quot;</span><span class=cF0>;
<a name="l381"></a> </span><span class=cF5>Sprite</span><span class=cF0>(</span><span class=cFA>&lt;17&gt;</span><span class=cF0>);
<a name="l382"></a> </span><span class=cF6>'\n\n\n\n\n'</span><span class=cF0>;
<a name="l383"></a>
<a name="l384"></a> DrawDC2;
<a name="l385"></a>
<a name="l386"></a> </span><span class=cF6>&quot;$LTGREEN$&lt;SPACE&gt;$FG$\t\tRest\n&quot;</span><span class=cF0>
<a name="l387"></a> </span><span class=cF6>&quot;$LTGREEN$&lt;BACKSPACE&gt;$FG$\tDeletes Last Note\n&quot;</span><span class=cF0>
<a name="l388"></a> </span><span class=cF6>&quot;$LTGREEN$Left Mouse$FG$\tDrag note or shift word\n&quot;</span><span class=cF0>
<a name="l389"></a> </span><span class=cF6>&quot;$LTGREEN$Right Mouse$FG$\tChange duration or set word\n&quot;</span><span class=cF0>;
<a name="l390"></a> </span><span class=cF5>Sprite</span><span class=cF0>(</span><span class=cFA>&lt;6&gt;</span><span class=cF0>,</span><span class=cF6>&quot;$SP+LIS,\&quot;\&quot;,&quot;</span><span class=cF0>
<a name="l391"></a> </span><span class=cF6>&quot;LM=\&quot;Msg(MSG_KEY_DOWN,0,SCF_CTRL|SC_CURSOR_LEFT);\&quot;,BI=%d$&quot;</span><span class=cF0>);
<a name="l392"></a> </span><span class=cF6>&quot; &quot;</span><span class=cF0>;
<a name="l393"></a> </span><span class=cF1>if</span><span class=cF0> (psm.playing)
<a name="l394"></a> </span><span class=cF5>Sprite</span><span class=cF0>(</span><span class=cFA>&lt;9&gt;</span><span class=cF0>,</span><span class=cF6>&quot;$SP,\&quot;\&quot;,LM=\&quot;x\&quot;,BI=%d$&quot;</span><span class=cF0>);
<a name="l395"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l396"></a> </span><span class=cF5>Sprite</span><span class=cF0>(</span><span class=cFA>&lt;8&gt;</span><span class=cF0>,</span><span class=cF6>&quot;$SP,\&quot;\&quot;,LM=\&quot;x\&quot;,BI=%d$&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=cF1>if</span><span class=cF0> (psm.record_entry-&gt;checked) </span><span class=cF7>{</span><span class=cF0>
<a name="l399"></a> psm.record_entry-&gt;checked=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l400"></a> </span><span class=cF5>Sprite</span><span class=cF0>(</span><span class=cFA>&lt;10&gt;</span><span class=cF0>,</span><span class=cF6>&quot;$SP,\&quot;\&quot;,LM=\&quot;z\&quot;,BI=%d$&quot;</span><span class=cF0>);
<a name="l401"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l402"></a> </span><span class=cF5>Sprite</span><span class=cF0>(</span><span class=cFA>&lt;11&gt;</span><span class=cF0>,</span><span class=cF6>&quot;$SP,\&quot;\&quot;,LM=\&quot;z\&quot;,BI=%d$&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=cF5>Sprite</span><span class=cF0>(</span><span class=cFA>&lt;7&gt;</span><span class=cF0>,</span><span class=cF6>&quot;$SP+LIS,\&quot;\&quot;,&quot;</span><span class=cF0>
<a name="l405"></a> </span><span class=cF6>&quot;LM=\&quot;Msg(MSG_KEY_DOWN,0,SCF_CTRL|SC_CURSOR_RIGHT);\&quot;,BI=%d$&quot;</span><span class=cF0>);
<a name="l406"></a> </span><span class=cF6>&quot;$CM+LX,0,6$&quot;</span><span class=cF0>;
<a name="l407"></a> PsmSetOctave(psm_octave);
<a name="l408"></a> </span><span class=cF5>Refresh</span><span class=cF0>(2);
<a name="l409"></a>}
</span></pre></body>
</html>