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

121 lines
8.5 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> TEMPO_SPACING 15
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> TEMPO_RANGE 80
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> TEMPO_BORDER 2
<a name="l4"></a>
<a name="l5"></a></span><span class=cF1>class</span><span class=cF0> TempoState
<a name="l6"></a>{
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> tempo,stacatto;
<a name="l8"></a>} tempo_state;
<a name="l9"></a>
<a name="l10"></a></span><span class=cF1>U0</span><span class=cF0> DrawTempoCtrl(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF9>CCtrl</span><span class=cF0> *c)
<a name="l11"></a>{
<a name="l12"></a> TempoState *s=c-&gt;state;
<a name="l13"></a>
<a name="l14"></a> dc-&gt;color=</span><span class=cF3>LTGREEN</span><span class=cF0>;
<a name="l15"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c-&gt;left,c-&gt;top,TEMPO_SPACING*3+2,TEMPO_SPACING*2+TEMPO_RANGE);
<a name="l16"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l17"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c-&gt;left+TEMPO_BORDER,c-&gt;top+TEMPO_BORDER,
<a name="l18"></a> TEMPO_SPACING*3+2-2*TEMPO_BORDER,
<a name="l19"></a> TEMPO_SPACING*2+TEMPO_RANGE-2*TEMPO_BORDER);
<a name="l20"></a> dc-&gt;color=</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l21"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,c-&gt;left+TEMPO_SPACING,c-&gt;top+TEMPO_SPACING,
<a name="l22"></a> c-&gt;left+TEMPO_SPACING,c-&gt;top+TEMPO_SPACING+TEMPO_RANGE-1);
<a name="l23"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,c-&gt;left+2*TEMPO_SPACING+1,c-&gt;top+TEMPO_SPACING,
<a name="l24"></a> c-&gt;left+2*TEMPO_SPACING+1,c-&gt;top+TEMPO_SPACING+TEMPO_RANGE-1);
<a name="l25"></a>
<a name="l26"></a> dc-&gt;color=</span><span class=cF3>LTGREEN</span><span class=cF0>;
<a name="l27"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,c-&gt;left+TEMPO_SPACING-</span><span class=cF3>FONT_WIDTH</span><span class=cF0>/2,
<a name="l28"></a> c-&gt;top+TEMPO_SPACING+TEMPO_RANGE+3,</span><span class=cF6>&quot;%d&quot;</span><span class=cF0>,s-&gt;tempo*10/TEMPO_RANGE);
<a name="l29"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,c-&gt;left+2*TEMPO_SPACING+1-</span><span class=cF3>FONT_WIDTH</span><span class=cF0>/2,
<a name="l30"></a> c-&gt;top+TEMPO_SPACING+TEMPO_RANGE+3,</span><span class=cF6>&quot;%d&quot;</span><span class=cF0>,
<a name="l31"></a> s-&gt;stacatto*10/TEMPO_RANGE);
<a name="l32"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,c-&gt;left+TEMPO_SPACING-3,
<a name="l33"></a> c-&gt;top+TEMPO_SPACING+TEMPO_RANGE-1-s-&gt;tempo-2 ,7,5);
<a name="l34"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,c-&gt;left+2*TEMPO_SPACING+1-3,
<a name="l35"></a> c-&gt;top+TEMPO_SPACING+TEMPO_RANGE-1-s-&gt;stacatto-2,7,5);
<a name="l36"></a> dc-&gt;color=</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l37"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,c-&gt;left+TEMPO_SPACING-2,
<a name="l38"></a> c-&gt;top+TEMPO_SPACING+TEMPO_RANGE-1-s-&gt;tempo-1 ,5,3);
<a name="l39"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,c-&gt;left+2*TEMPO_SPACING+1-2,
<a name="l40"></a> c-&gt;top+TEMPO_SPACING+TEMPO_RANGE-1-s-&gt;stacatto-1,5,3);
<a name="l41"></a>
<a name="l42"></a> dc-&gt;color=</span><span class=cF3>GREEN</span><span class=cF0>;
<a name="l43"></a> </span><span class=cF5>GrVPrint</span><span class=cF0>(dc,c-&gt;left+TEMPO_BORDER+2,c-&gt;top+TEMPO_SPACING+2,</span><span class=cF6>&quot;Tempo&quot;</span><span class=cF0>);
<a name="l44"></a> </span><span class=cF5>GrVPrint</span><span class=cF0>(dc,c-&gt;right-TEMPO_BORDER-2-</span><span class=cF3>FONT_WIDTH</span><span class=cF0>,
<a name="l45"></a> c-&gt;top+TEMPO_SPACING+2,</span><span class=cF6>&quot;Stacatto&quot;</span><span class=cF0>);
<a name="l46"></a>}
<a name="l47"></a>
<a name="l48"></a></span><span class=cF1>U0</span><span class=cF0> UpdateDerivedTempoCtrl(</span><span class=cF9>CCtrl</span><span class=cF0> *c)
<a name="l49"></a>{
<a name="l50"></a> TempoState *s=c-&gt;state;
<a name="l51"></a> c-&gt;right=c-&gt;left+TEMPO_SPACING*3+2;
<a name="l52"></a> c-&gt;bottom=c-&gt;top+TEMPO_SPACING*2+TEMPO_RANGE;
<a name="l53"></a> s-&gt;tempo =</span><span class=cF5>ClampI64</span><span class=cF0>(s-&gt;tempo,0,TEMPO_RANGE-1);
<a name="l54"></a> s-&gt;stacatto=</span><span class=cF5>ClampI64</span><span class=cF0>(s-&gt;stacatto,0,TEMPO_RANGE-1);
<a name="l55"></a>}
<a name="l56"></a>
<a name="l57"></a></span><span class=cF1>U0</span><span class=cF0> LeftClickTempo(</span><span class=cF9>CCtrl</span><span class=cF0> *c,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF1>Bool</span><span class=cF0>)
<a name="l58"></a>{
<a name="l59"></a> TempoState *s=c-&gt;state;
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (x&lt;</span><span class=cF7>(</span><span class=cF0>c-&gt;right+c-&gt;left</span><span class=cF7>)</span><span class=cF0>/2)
<a name="l61"></a> s-&gt;tempo=TEMPO_RANGE-1-(y-</span><span class=cF7>(</span><span class=cF0>c-&gt;top+TEMPO_SPACING</span><span class=cF7>)</span><span class=cF0>);
<a name="l62"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l63"></a> s-&gt;stacatto=TEMPO_RANGE-1-(y-</span><span class=cF7>(</span><span class=cF0>c-&gt;top+TEMPO_SPACING</span><span class=cF7>)</span><span class=cF0>);
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (c-&gt;update_derived_vals)
<a name="l65"></a> (*c-&gt;update_derived_vals)(c);
<a name="l66"></a>}
<a name="l67"></a>
<a name="l68"></a></span><span class=cF9>CCtrl</span><span class=cF0> *TempoNew()
<a name="l69"></a>{
<a name="l70"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CCtrl</span><span class=cF7>)</span><span class=cF0>);
<a name="l71"></a> c-&gt;win_task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l72"></a> c-&gt;flags=</span><span class=cF3>CTRLF_SHOW</span><span class=cF0>|</span><span class=cF3>CTRLF_CAPTURE_LEFT_MS</span><span class=cF0>;
<a name="l73"></a> c-&gt;type=</span><span class=cF3>CTRLT_GENERIC</span><span class=cF0>;
<a name="l74"></a> c-&gt;state=&amp;tempo_state;
<a name="l75"></a> c-&gt;draw_it=&amp;DrawTempoCtrl;
<a name="l76"></a> c-&gt;left_click=&amp;LeftClickTempo;
<a name="l77"></a> c-&gt;update_derived_vals=&amp;UpdateDerivedTempoCtrl;
<a name="l78"></a> c-&gt;left=396;
<a name="l79"></a> c-&gt;top=96;
<a name="l80"></a> </span><span class=cF5>QueIns</span><span class=cF0>(c,</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_ctrl);
<a name="l81"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>;
<a name="l82"></a> </span><span class=cF1>return</span><span class=cF0> c;
<a name="l83"></a>}
<a name="l84"></a>
<a name="l85"></a></span><span class=cF1>U0</span><span class=cF0> TempoDel(</span><span class=cF9>CCtrl</span><span class=cF0> *c)
<a name="l86"></a>{
<a name="l87"></a> </span><span class=cF5>QueRem</span><span class=cF0>(c);
<a name="l88"></a> </span><span class=cF5>Free</span><span class=cF0>(c);
<a name="l89"></a>}
</span></pre></body>
</html>