ZealOS/docs/Apps/Span/SpanMain.CC.html
2021-08-17 02:47:37 -04:00

555 lines
49 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.00">
<style type="text/css">
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF1>F64</span><span class=cF0> SpanTime()
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF1>if</span><span class=cF0> (run_bttn.state)
<a name="l4"></a> </span><span class=cF1>return</span><span class=cF0> a.elapsed_t + </span><span class=cF5>tS</span><span class=cF0> - a.start_wall_t;
<a name="l5"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l6"></a> </span><span class=cF1>return</span><span class=cF0> a.elapsed_t;
<a name="l7"></a>}
<a name="l8"></a>
<a name="l9"></a></span><span class=cF1>F64</span><span class=cF0> Cost(</span><span class=cF9>CMathODE</span><span class=cF0> *ode)
<a name="l10"></a>{
<a name="l11"></a> MyMass *tmpm;
<a name="l12"></a> MySpring *tmps;
<a name="l13"></a> </span><span class=cF1>F64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l14"></a>
<a name="l15"></a> tmpm=ode-&gt;next_mass;
<a name="l16"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &amp;ode-&gt;next_mass)
<a name="l17"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l18"></a> res += tmpm-&gt;cost;
<a name="l19"></a> tmpm = tmpm-&gt;next;
<a name="l20"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l21"></a> tmps = ode-&gt;next_spring;
<a name="l22"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l23"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l24"></a> res += tmps-&gt;cost;
<a name="l25"></a> tmps = tmps-&gt;next;
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l27"></a>
<a name="l28"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l29"></a>}
<a name="l30"></a>
<a name="l31"></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="l32"></a>{
<a name="l33"></a> MyMass *tmpm;
<a name="l34"></a> MySpring *tmps;
<a name="l35"></a>
<a name="l36"></a> tmps = ode-&gt;next_spring;
<a name="l37"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l38"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmps-&gt;flags &amp; </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l40"></a> {
<a name="l41"></a> dc-&gt;color = tmps-&gt;color;
<a name="l42"></a> dc-&gt;thick = tmps-&gt;thick;
<a name="l43"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, tmps-&gt;end1-&gt;x, tmps-&gt;end1-&gt;y, </span><span class=cFE>0</span><span class=cF0>, tmps-&gt;end2-&gt;x, tmps-&gt;end2-&gt;y, </span><span class=cFE>0</span><span class=cF0>);
<a name="l44"></a> }
<a name="l45"></a> tmps = tmps-&gt;next;
<a name="l46"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l47"></a>
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (cursor_mass)
<a name="l49"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l50"></a> dc-&gt;color = </span><span class=cF3>RED</span><span class=cF0>;
<a name="l51"></a> dc-&gt;thick = </span><span class=cFE>2</span><span class=cF0>;
<a name="l52"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFB>mouse</span><span class=cF0>.pos.x - task-&gt;pix_left - task-&gt;scroll_x,
<a name="l53"></a> </span><span class=cFB>mouse</span><span class=cF0>.pos.y - task-&gt;pix_top - task-&gt;scroll_y, </span><span class=cFE>0</span><span class=cF0>,
<a name="l54"></a> cursor_mass-&gt;x, cursor_mass-&gt;y, </span><span class=cFE>0</span><span class=cF0>);
<a name="l55"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l56"></a>
<a name="l57"></a> tmpm=ode-&gt;next_mass;
<a name="l58"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &amp;ode-&gt;next_mass)
<a name="l59"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpm-&gt;flags&amp;</span><span class=cF3>MSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l61"></a> {
<a name="l62"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l63"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpm-&gt;x, tmpm-&gt;y, tmpm-&gt;radius);
<a name="l64"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc, tmpm-&gt;x, tmpm-&gt;y, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l65"></a> dc-&gt;color = tmpm-&gt;color;
<a name="l66"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpm-&gt;x, tmpm-&gt;y, tmpm-&gt;radius);
<a name="l67"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc, tmpm-&gt;x, tmpm-&gt;y, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l68"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l69"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpm-&gt;x, tmpm-&gt;y, tmpm-&gt;radius);
<a name="l70"></a> }
<a name="l71"></a> tmpm = tmpm-&gt;next;
<a name="l72"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l73"></a>
<a name="l74"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l75"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>90</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>&quot;Cost:%12.2,f&quot;</span><span class=cF0>, Cost</span><span class=cF7>(</span><span class=cF0>ode</span><span class=cF7>)</span><span class=cF0>);
<a name="l76"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>90</span><span class=cF0>, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, </span><span class=cF6>&quot;Time:%12.2f&quot;</span><span class=cF0>, SpanTime);
<a name="l77"></a>}
<a name="l78"></a>
<a name="l79"></a>MyMass *PlaceMass(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
<a name="l80"></a>{
<a name="l81"></a> MyMass *tmpm = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>MyMass</span><span class=cF7>)</span><span class=cF0>);
<a name="l82"></a>
<a name="l83"></a> tmpm-&gt;drag_profile_factor = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l84"></a> tmpm-&gt;x = x;
<a name="l85"></a> tmpm-&gt;y = y;
<a name="l86"></a> tmpm-&gt;mass = MASS_MASS;
<a name="l87"></a> tmpm-&gt;radius = MASS_RADIUS;
<a name="l88"></a> tmpm-&gt;cost = </span><span class=cFE>25</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * COST_SCALE;
<a name="l89"></a> tmpm-&gt;color = </span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l90"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpm, ode-&gt;last_mass);
<a name="l91"></a>
<a name="l92"></a> </span><span class=cF1>return</span><span class=cF0> tmpm;
<a name="l93"></a>}
<a name="l94"></a>
<a name="l95"></a></span><span class=cF1>U0</span><span class=cF0> NullSpring(MySpring *tmps, </span><span class=cF1>F64</span><span class=cF0> scale)
<a name="l96"></a>{
<a name="l97"></a> </span><span class=cF1>F64</span><span class=cF0> d = </span><span class=cF5>D3Dist</span><span class=cF0>(&amp;tmps-&gt;end1-&gt;x, &amp;tmps-&gt;end2-&gt;x);
<a name="l98"></a>
<a name="l99"></a> tmps-&gt;rest_len = d * scale;
<a name="l100"></a> tmps-&gt;compression_strength = tmps-&gt;base_compression_strength / (tmps-&gt;rest_len + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l101"></a> tmps-&gt;tensile_strength = tmps-&gt;base_tensile_strength / (tmps-&gt;rest_len + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l102"></a> tmps-&gt;const = tmps-&gt;base_const / (tmps-&gt;rest_len + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l103"></a> tmps-&gt;cost = tmps-&gt;base_cost * tmps-&gt;rest_len;
<a name="l104"></a>}
<a name="l105"></a>
<a name="l106"></a></span><span class=cF1>U0</span><span class=cF0> MoveMass(MyMass *tmpm, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
<a name="l107"></a>{
<a name="l108"></a> MySpring *tmps;
<a name="l109"></a>
<a name="l110"></a> tmpm-&gt;x = x;
<a name="l111"></a> tmpm-&gt;y = y;
<a name="l112"></a> tmpm-&gt;DxDt = </span><span class=cFE>0</span><span class=cF0>;
<a name="l113"></a> tmpm-&gt;DyDt = </span><span class=cFE>0</span><span class=cF0>;
<a name="l114"></a> tmps = ode-&gt;next_spring;
<a name="l115"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l116"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;end1 == tmpm || tmps-&gt;end2 == tmpm)
<a name="l118"></a> {
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;flags &amp; </span><span class=cF3>SSF_NO_COMPRESSION</span><span class=cF0>)
<a name="l120"></a> NullSpring(tmps, WIRE_PERCENT);
<a name="l121"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l122"></a> NullSpring(tmps, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l123"></a> }
<a name="l124"></a> tmps = tmps-&gt;next;
<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> DelSpring(MySpring *tmps)
<a name="l129"></a>{
<a name="l130"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmps);
<a name="l131"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
<a name="l132"></a>}
<a name="l133"></a>
<a name="l134"></a></span><span class=cF1>U0</span><span class=cF0> DelMass(MyMass *tmpm)
<a name="l135"></a>{
<a name="l136"></a> MySpring *tmps, *tmps1;
<a name="l137"></a>
<a name="l138"></a> tmps = ode-&gt;next_spring;
<a name="l139"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l140"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l141"></a> tmps1 = tmps-&gt;next;
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;end1 == tmpm || tmps-&gt;end2 == tmpm)
<a name="l143"></a> DelSpring(tmps);
<a name="l144"></a> tmps = tmps1;
<a name="l145"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l146"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpm);
<a name="l147"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpm);
<a name="l148"></a>}
<a name="l149"></a>
<a name="l150"></a></span><span class=cF1>U0</span><span class=cF0> DrawSpring(</span><span class=cF9>CDC</span><span class=cF0> *dc, MyMass *tmpm, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
<a name="l151"></a>{
<a name="l152"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
<a name="l153"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l154"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
<a name="l155"></a> dc-&gt;color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
<a name="l156"></a> dc-&gt;thick = </span><span class=cFE>2</span><span class=cF0>;
<a name="l157"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l158"></a>
<a name="l159"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
<a name="l160"></a> dc-&gt;color = </span><span class=cF3>DKGRAY</span><span class=cF0>;
<a name="l161"></a> dc-&gt;thick = </span><span class=cFE>2</span><span class=cF0>;
<a name="l162"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l163"></a>
<a name="l164"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
<a name="l165"></a> dc-&gt;color = </span><span class=cF3>RED</span><span class=cF0>;
<a name="l166"></a> dc-&gt;thick = </span><span class=cFE>1</span><span class=cF0>;
<a name="l167"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l168"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l169"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, tmpm-&gt;x, tmpm-&gt;y, </span><span class=cFE>0</span><span class=cF0>, x, y, </span><span class=cFE>0</span><span class=cF0>);
<a name="l170"></a>}
<a name="l171"></a>
<a name="l172"></a></span><span class=cF1>U0</span><span class=cF0> PlaceSpring(MyMass *tmpm1, MyMass *tmpm2)
<a name="l173"></a>{
<a name="l174"></a> MySpring *tmps = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>MySpring</span><span class=cF7>)</span><span class=cF0>);
<a name="l175"></a>
<a name="l176"></a> tmps-&gt;end1 = tmpm1;
<a name="l177"></a> tmps-&gt;end2 = tmpm2;
<a name="l178"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
<a name="l179"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l180"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
<a name="l181"></a> tmps-&gt;base_const = </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * SPRING_SCALE;
<a name="l182"></a> tmps-&gt;base_compression_strength = </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * STRENGTH_SCALE;
<a name="l183"></a> tmps-&gt;base_tensile_strength = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>35</span><span class=cF0> * STRENGTH_SCALE;
<a name="l184"></a> tmps-&gt;base_cost = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>30</span><span class=cF0> * COST_SCALE;
<a name="l185"></a> NullSpring(tmps, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l186"></a> tmps-&gt;color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
<a name="l187"></a> tmps-&gt;thick = </span><span class=cFE>2</span><span class=cF0>;
<a name="l188"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l189"></a>
<a name="l190"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
<a name="l191"></a> tmps-&gt;base_const = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * SPRING_SCALE;
<a name="l192"></a> tmps-&gt;base_compression_strength = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * STRENGTH_SCALE;
<a name="l193"></a> tmps-&gt;base_tensile_strength = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * STRENGTH_SCALE;
<a name="l194"></a> tmps-&gt;base_cost = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * COST_SCALE;
<a name="l195"></a> NullSpring(tmps, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l196"></a> tmps-&gt;color = </span><span class=cF3>DKGRAY</span><span class=cF0>;
<a name="l197"></a> tmps-&gt;thick = </span><span class=cFE>2</span><span class=cF0>;
<a name="l198"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l199"></a>
<a name="l200"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
<a name="l201"></a> tmps-&gt;base_const = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0> * SPRING_SCALE;
<a name="l202"></a> tmps-&gt;base_compression_strength = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0>;
<a name="l203"></a> tmps-&gt;base_tensile_strength = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>50</span><span class=cF0> * STRENGTH_SCALE;
<a name="l204"></a> tmps-&gt;base_cost = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>10</span><span class=cF0> * COST_SCALE;
<a name="l205"></a> NullSpring(tmps, WIRE_PERCENT);
<a name="l206"></a> tmps-&gt;color = </span><span class=cF3>RED</span><span class=cF0>;
<a name="l207"></a> tmps-&gt;thick = </span><span class=cFE>1</span><span class=cF0>;
<a name="l208"></a> tmps-&gt;flags |= </span><span class=cF3>SSF_NO_COMPRESSION</span><span class=cF0>;
<a name="l209"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l210"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l211"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmps, ode-&gt;last_spring);
<a name="l212"></a>}
<a name="l213"></a>
<a name="l214"></a></span><span class=cF1>U0</span><span class=cF0> AnimateTask(SpanAnimateStruct *a)
<a name="l215"></a>{
<a name="l216"></a> MySpring *tmps, *tmps1;
<a name="l217"></a> </span><span class=cF1>Bool</span><span class=cF0> old_run = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l218"></a> </span><span class=cF1>F64</span><span class=cF0> f;
<a name="l219"></a>
<a name="l220"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l221"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l222"></a> tmps = ode-&gt;next_spring;
<a name="l223"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l224"></a> {
<a name="l225"></a> tmps1 = tmps-&gt;next;
<a name="l226"></a> f = tmps-&gt;f;
<a name="l227"></a> </span><span class=cF1>if</span><span class=cF0> ( f &gt; </span><span class=cFE>0</span><span class=cF0> &amp;&amp; f &gt; tmps-&gt;compression_strength &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>tmps-&gt;flags &amp; </span><span class=cF3>SSF_NO_COMPRESSION</span><span class=cF7>)</span><span class=cF0> ||
<a name="l228"></a> f &lt; </span><span class=cFE>0</span><span class=cF0> &amp;&amp; -f&gt;tmps-&gt;tensile_strength &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>tmps-&gt;flags &amp; </span><span class=cF3>SSF_NO_TENSION</span><span class=cF7>)</span><span class=cF0>)
<a name="l229"></a> tmps-&gt;flags |= </span><span class=cF3>SSF_INACTIVE</span><span class=cF0>;
<a name="l230"></a> tmps = tmps1;
<a name="l231"></a> }
<a name="l232"></a> AdjustLoads(ode);
<a name="l233"></a> </span><span class=cF5>Refresh</span><span class=cF0>; </span><span class=cF2>//CMathODE updated once per refresh.</span><span class=cF0>
<a name="l234"></a> </span><span class=cF1>if</span><span class=cF0> (old_run != run_bttn.state)
<a name="l235"></a> {
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (run_bttn.state)
<a name="l237"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l238"></a> </span><span class=cF1>if</span><span class=cF0> (!a-&gt;elapsed_t || !a-&gt;saved_ode)
<a name="l239"></a> {
<a name="l240"></a> </span><span class=cF5>Free</span><span class=cF0>(a-&gt;saved_ode);
<a name="l241"></a> a-&gt;saved_ode = SpanSave(ode);
<a name="l242"></a> }
<a name="l243"></a> a-&gt;start_wall_t = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l244"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode, </span><span class=cF3>OFF</span><span class=cF0>);
<a name="l245"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l246"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l247"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l248"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode);
<a name="l249"></a> a-&gt;elapsed_t += </span><span class=cF5>tS</span><span class=cF0> - a-&gt;start_wall_t;
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l251"></a> old_run = run_bttn.state;
<a name="l252"></a> }
<a name="l253"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l254"></a>}
<a name="l255"></a>
<a name="l256"></a></span><span class=cF1>U0</span><span class=cF0> Init(SpanAnimateStruct *a)
<a name="l257"></a>{
<a name="l258"></a> SpanDel(ode);
<a name="l259"></a> ode = SpanNew;
<a name="l260"></a>
<a name="l261"></a> run_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
<a name="l262"></a> </span><span class=cF5>Refresh</span><span class=cF0>(</span><span class=cFE>2</span><span class=cF0>); </span><span class=cF2>//Allow stop to reg in animate task.</span><span class=cF0>
<a name="l263"></a>
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (a-&gt;saved_ode)
<a name="l265"></a> SpanLoad(ode, a-&gt;saved_ode);
<a name="l266"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l267"></a> SpanBridge1Init(ode);
<a name="l268"></a> a-&gt;elapsed_t = </span><span class=cFE>0</span><span class=cF0>;
<a name="l269"></a> cursor_mass = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l270"></a>}
<a name="l271"></a>
<a name="l272"></a></span><span class=cF1>U0</span><span class=cF0> SongTask(</span><span class=cF9>I64</span><span class=cF0>)
<a name="l273"></a>{</span><span class=cF2>//Song by Terry A. Davis</span><span class=cF0>
<a name="l274"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;task_end_cb = &amp;</span><span class=cF5>SoundTaskEndCB</span><span class=cF0>;
<a name="l275"></a> </span><span class=cF5>MusicSettingsReset</span><span class=cF0>;
<a name="l276"></a> </span><span class=cFB>music</span><span class=cF0>.tempo = </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>636</span><span class=cF0>;
<a name="l277"></a> </span><span class=cFB>music</span><span class=cF0>.stacatto_factor = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>902</span><span class=cF0>;
<a name="l278"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l279"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l280"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>&quot;5q.EeDqED4G5DhE&quot;</span><span class=cF0>);
<a name="l281"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>&quot;5q.EeDqED4G5DhE&quot;</span><span class=cF0>);
<a name="l282"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>&quot;5q.FeEFEqF4G5EhF&quot;</span><span class=cF0>);
<a name="l283"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>&quot;5q.FeEFEqF4G5EhF&quot;</span><span class=cF0>);
<a name="l284"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l285"></a>}
<a name="l286"></a>
<a name="l287"></a></span><span class=cF1>U0</span><span class=cF0> Span()
<a name="l288"></a>{
<a name="l289"></a> </span><span class=cF9>I64</span><span class=cF0> message_code, arg1, arg2;
<a name="l290"></a> MyMass *tmpm1 = </span><span class=cF3>NULL</span><span class=cF0>, *tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l291"></a> MySpring *tmps;
<a name="l292"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *bt_run, *bt_mode;
<a name="l293"></a> </span><span class=cF1>U8</span><span class=cF0> *src;
<a name="l294"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>;
<a name="l295"></a>
<a name="l296"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
<a name="l297"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;text_attr = </span><span class=cF3>BROWN</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l298"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l299"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
<a name="l300"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l301"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
<a name="l302"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;song_task = </span><span class=cF5>Spawn</span><span class=cF0>(&amp;SongTask, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF6>&quot;Song&quot;</span><span class=cF0>,, </span><span class=cF5>Fs</span><span class=cF0>);
<a name="l303"></a>
<a name="l304"></a> bt_run =</span><span class=cF5>CtrlBttnNew</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>80</span><span class=cF0>,, </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF6>&quot;Stopped\0Running\0&quot;</span><span class=cF0>, run_colors, &amp;run_bttn);
<a name="l305"></a> bt_mode=</span><span class=cF5>CtrlBttnNew</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, </span><span class=cFE>80</span><span class=cF0>,, MD_MODES_NUM, </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>&quot;ST_SPAN_MODES&quot;</span><span class=cF7>)</span><span class=cF0>, mode_colors, &amp;mode_bttn);
<a name="l306"></a> a.saved_ode = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l307"></a>
<a name="l308"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit |= </span><span class=cF3>WIG_DBL_CLICK</span><span class=cF0>;
<a name="l309"></a>
<a name="l310"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l311"></a> </span><span class=cF6>&quot; New(,CH_CTRLN);&quot;</span><span class=cF0>
<a name="l312"></a> </span><span class=cF6>&quot; Open(,CH_CTRLO);&quot;</span><span class=cF0>
<a name="l313"></a> </span><span class=cF6>&quot; SaveAs(,CH_CTRLA);&quot;</span><span class=cF0>
<a name="l314"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l315"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l316"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l317"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l318"></a> </span><span class=cF6>&quot; Restart(,'\n');&quot;</span><span class=cF0>
<a name="l319"></a> </span><span class=cF6>&quot; RunStop(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l320"></a> </span><span class=cF6>&quot; Mass(,'m');&quot;</span><span class=cF0>
<a name="l321"></a> </span><span class=cF6>&quot; Concrete(,'c');&quot;</span><span class=cF0>
<a name="l322"></a> </span><span class=cF6>&quot; Steel(,'s');&quot;</span><span class=cF0>
<a name="l323"></a> </span><span class=cF6>&quot; Wire(,'w');&quot;</span><span class=cF0>
<a name="l324"></a> </span><span class=cF6>&quot; Move(,'v');&quot;</span><span class=cF0>
<a name="l325"></a> </span><span class=cF6>&quot; Delete(,'d');&quot;</span><span class=cF0>
<a name="l326"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l327"></a> );
<a name="l328"></a>
<a name="l329"></a> ode = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l330"></a> Init(&amp;a);
<a name="l331"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;animate_task = </span><span class=cF5>Spawn</span><span class=cF0>(&amp;AnimateTask, &amp;a, </span><span class=cF6>&quot;Animate&quot;</span><span class=cF0>,, </span><span class=cF5>Fs</span><span class=cF0>);
<a name="l332"></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="l333"></a>
<a name="l334"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>( </span><span class=cF6>&quot;Build a bridge to hold-up the\n&quot;</span><span class=cF0>
<a name="l335"></a> </span><span class=cF6>&quot;red masses. Test your design\n&quot;</span><span class=cF0>
<a name="l336"></a> </span><span class=cF6>&quot;by pressing run/stop.\n\n&quot;</span><span class=cF0>
<a name="l337"></a> </span><span class=cF6>&quot;The lowest cost bridge that\n&quot;</span><span class=cF0>
<a name="l338"></a> </span><span class=cF6>&quot;stays standing wins.\n\n&quot;</span><span class=cF0>
<a name="l339"></a> </span><span class=cF6>&quot;For a variation, try without\n&quot;</span><span class=cF0>
<a name="l340"></a> </span><span class=cF6>&quot;using the center base point.\n&quot;</span><span class=cF0>
<a name="l341"></a> </span><span class=cF6>&quot;\n&quot;</span><span class=cF0>
<a name="l342"></a> </span><span class=cF6>&quot;Use\n&quot;</span><span class=cF0>
<a name="l343"></a> </span><span class=cF6>&quot;\t$GREEN$'m'$FG$ass\n&quot;</span><span class=cF0>
<a name="l344"></a> </span><span class=cF6>&quot;\t$GREEN$'c'$FG$oncrete\n&quot;</span><span class=cF0>
<a name="l345"></a> </span><span class=cF6>&quot;\t$GREEN$'s'$FG$teel\n&quot;</span><span class=cF0>
<a name="l346"></a> </span><span class=cF6>&quot;\t$GREEN$'w'$FG$ire\n&quot;</span><span class=cF0>
<a name="l347"></a> </span><span class=cF6>&quot;\nto sel materials.\n&quot;</span><span class=cF0>);
<a name="l348"></a>
<a name="l349"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l350"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l351"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l352"></a> {
<a name="l353"></a> message_code = </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0> |
<a name="l354"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>);
<a name="l355"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l356"></a> </span><span class=cF1>switch</span><span class=cF0> (message_code)
<a name="l357"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l358"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>:
<a name="l359"></a> cursor_mass = tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l360"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
<a name="l361"></a> {
<a name="l362"></a> </span><span class=cF1>case</span><span class=cF0> MD_MASS:
<a name="l363"></a> PlaceMass(arg1, arg2);
<a name="l364"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l365"></a>
<a name="l366"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
<a name="l367"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
<a name="l368"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
<a name="l369"></a> tmpm1 = </span><span class=cF5>MassFind</span><span class=cF0>(ode, arg1, arg2);
<a name="l370"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l371"></a>
<a name="l372"></a> </span><span class=cF1>case</span><span class=cF0> MD_MOVE:
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (run_bttn.state)
<a name="l374"></a> cursor_mass = </span><span class=cF5>MassFind</span><span class=cF0>(ode, arg1, arg2);
<a name="l375"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l376"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1 = </span><span class=cF5>MassFind</span><span class=cF7>(</span><span class=cF0>ode, arg1, arg2</span><span class=cF7>)</span><span class=cF0>)
<a name="l377"></a> MoveMass(tmpm1, arg1, arg2);
<a name="l378"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l379"></a>
<a name="l380"></a> </span><span class=cF1>case</span><span class=cF0> MD_DELETE:
<a name="l381"></a> </span><span class=cF5>MassOrSpringFind</span><span class=cF0>(ode, &amp;tmpm1, &amp;tmps, arg1, arg2);
<a name="l382"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1)
<a name="l383"></a> DelMass(tmpm1);
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (tmps)
<a name="l385"></a> DelSpring(tmps);
<a name="l386"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l387"></a> }
<a name="l388"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l389"></a>
<a name="l390"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>:
<a name="l391"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
<a name="l392"></a> {
<a name="l393"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
<a name="l394"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
<a name="l395"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
<a name="l396"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1 &amp;&amp; </span><span class=cF7>(</span><span class=cF0>tmpm2 = </span><span class=cF5>MassFind</span><span class=cF0>(ode, arg1, arg2)</span><span class=cF7>)</span><span class=cF0> &amp;&amp; tmpm1 != tmpm2)
<a name="l397"></a> PlaceSpring(tmpm1, tmpm2);
<a name="l398"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l399"></a>
<a name="l400"></a> </span><span class=cF1>case</span><span class=cF0> MD_MOVE:
<a name="l401"></a> </span><span class=cF1>if</span><span class=cF0> (!run_bttn.state &amp;&amp; tmpm1)
<a name="l402"></a> MoveMass(tmpm1, arg1, arg2);
<a name="l403"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l404"></a> }
<a name="l405"></a> cursor_mass = tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l406"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l407"></a>
<a name="l408"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>:
<a name="l409"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
<a name="l410"></a> {
<a name="l411"></a> </span><span class=cF1>case</span><span class=cF0> MD_MOVE:
<a name="l412"></a> </span><span class=cF1>if</span><span class=cF0> (!run_bttn.state &amp;&amp; tmpm1)
<a name="l413"></a> MoveMass(tmpm1, arg1, arg2);
<a name="l414"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l415"></a>
<a name="l416"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
<a name="l417"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
<a name="l418"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
<a name="l419"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1)
<a name="l420"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l421"></a> DrawSpring(dc, tmpm1, arg1, arg2);
<a name="l422"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l423"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l424"></a> }
<a name="l425"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l426"></a>
<a name="l427"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0>:
<a name="l428"></a> mode_bttn.state++;
<a name="l429"></a> </span><span class=cF1>if</span><span class=cF0> (mode_bttn.state &gt;= MD_MODES_NUM)
<a name="l430"></a> mode_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
<a name="l431"></a> cursor_mass = tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l432"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l433"></a>
<a name="l434"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
<a name="l435"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
<a name="l436"></a> {
<a name="l437"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l438"></a> </span><span class=cF1>if</span><span class=cF0> (!SpanTime || !a.saved_ode)
<a name="l439"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l440"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
<a name="l441"></a> a.saved_ode = SpanSave(ode);
<a name="l442"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l443"></a> Init(&amp;a);
<a name="l444"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l445"></a>
<a name="l446"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLN</span><span class=cF0>:
<a name="l447"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
<a name="l448"></a> a.saved_ode = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l449"></a> Init(&amp;a);
<a name="l450"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l451"></a>
<a name="l452"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLO</span><span class=cF0>:
<a name="l453"></a> </span><span class=cF1>if</span><span class=cF0> (src = SpanRead)
<a name="l454"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l455"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
<a name="l456"></a> a.saved_ode = src;
<a name="l457"></a> Init(&amp;a);
<a name="l458"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l459"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l460"></a>
<a name="l461"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLA</span><span class=cF0>:
<a name="l462"></a> </span><span class=cF1>if</span><span class=cF0> (!SpanTime || !a.saved_ode)
<a name="l463"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l464"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
<a name="l465"></a> a.saved_ode = SpanSave(ode);
<a name="l466"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l467"></a> Init(&amp;a);
<a name="l468"></a> SpanWrite(ode);
<a name="l469"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l470"></a>
<a name="l471"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l472"></a> run_bttn.state = !run_bttn.state;
<a name="l473"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l474"></a>
<a name="l475"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
<a name="l476"></a> mode_bttn.state = MD_CONCRETE;
<a name="l477"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l478"></a>
<a name="l479"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'s'</span><span class=cF0>:
<a name="l480"></a> mode_bttn.state = MD_STEEL;
<a name="l481"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l482"></a>
<a name="l483"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'w'</span><span class=cF0>:
<a name="l484"></a> mode_bttn.state = MD_WIRE;
<a name="l485"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l486"></a>
<a name="l487"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
<a name="l488"></a> mode_bttn.state = MD_MASS;
<a name="l489"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l490"></a>
<a name="l491"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
<a name="l492"></a> mode_bttn.state = MD_MOVE;
<a name="l493"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l494"></a>
<a name="l495"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
<a name="l496"></a> mode_bttn.state = MD_DELETE;
<a name="l497"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l498"></a>
<a name="l499"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l500"></a> </span><span class=cF1>if</span><span class=cF0> (!SpanTime || !a.saved_ode)
<a name="l501"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l502"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
<a name="l503"></a> a.saved_ode = SpanSave(ode);
<a name="l504"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l505"></a> Init(&amp;a);
<a name="l506"></a> SpanWrite(ode);
<a name="l507"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l508"></a> </span><span class=cF1>goto</span><span class=cF0> span_done;
<a name="l509"></a> }
<a name="l510"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l511"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l512"></a> }
<a name="l513"></a>span_done: </span><span class=cF2>//Don't goto out of try</span><span class=cF0>
<a name="l514"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
<a name="l515"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l516"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l517"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l518"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l519"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l520"></a> </span><span class=cF5>CtrlBttnDel</span><span class=cF0>(bt_run);
<a name="l521"></a> </span><span class=cF5>CtrlBttnDel</span><span class=cF0>(bt_mode);
<a name="l522"></a> SpanDel(ode);
<a name="l523"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l524"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l525"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l526"></a>}
</span></pre></body>
</html>