mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
d639cdcdf6
Rename 0000Kernel.BIN.C to Kernel.BIN.C.
144 lines
15 KiB
HTML
Executable file
144 lines
15 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.09">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF2>/*Done with <CTRL-SHIFT-L> template code</span><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF2>that was modified.</span><span class=cF0>
|
|
<a name="l3"></a>
|
|
<a name="l4"></a></span><span class=cF2>This is an advanced demo that shows</span><span class=cF0>
|
|
<a name="l5"></a></span><span class=cF2>that you can place ctrls on the</span><span class=cF0>
|
|
<a name="l6"></a></span><span class=cF2>wall paper.</span><span class=cF0>
|
|
<a name="l7"></a>
|
|
<a name="l8"></a></span><span class=cF2>See </span><a href="https://tomawezome.github.io/ZealOS/Demo/Graphics/Slider.CC.html#l1"><span class=cF4>::/Demo/Graphics/Slider.CC</span></a><span class=cF0>
|
|
<a name="l9"></a></span><span class=cF2>and </span><a href="https://tomawezome.github.io/ZealOS/Demo/Graphics/WallPaperFish.CC.html#l1"><span class=cF4>::/Demo/Graphics/WallPaperFish.CC</span></a><span class=cF0>
|
|
<a name="l10"></a></span><span class=cF2>before messing with this program.</span><span class=cF0>
|
|
<a name="l11"></a>
|
|
<a name="l12"></a></span><span class=cF2>It must be "System Included".</span><span class=cF0>
|
|
<a name="l13"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l14"></a>
|
|
<a name="l15"></a>#</span><span class=cF1>define</span><span class=cF0> SLIDER_RANGE </span><span class=cFE>30</span><span class=cF0>
|
|
<a name="l16"></a>#</span><span class=cF1>define</span><span class=cF0> SLIDER_SPACING </span><span class=cFE>20</span><span class=cF0>
|
|
<a name="l17"></a>#</span><span class=cF1>define</span><span class=cF0> SLIDER_BORDER </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l18"></a>
|
|
<a name="l19"></a></span><span class=cF1>class</span><span class=cF0> CSliderState
|
|
<a name="l20"></a>{
|
|
<a name="l21"></a> </span><span class=cF9>I64</span><span class=cF0> left_pos;
|
|
<a name="l22"></a> </span><span class=cF9>I64</span><span class=cF0> right_pos;
|
|
<a name="l23"></a>};
|
|
<a name="l24"></a>
|
|
<a name="l25"></a></span><span class=cF1>U0</span><span class=cF0> DrawCtrlSlider(</span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l26"></a>{
|
|
<a name="l27"></a> CSliderState *s = c->state;
|
|
<a name="l28"></a>
|
|
<a name="l29"></a> dc->color = </span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l30"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left, c->top, SLIDER_SPACING * </span><span class=cFE>3</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>, SLIDER_SPACING * </span><span class=cFE>2</span><span class=cF0> + SLIDER_RANGE);
|
|
<a name="l31"></a> dc->color = </span><span class=cF3>BLUE</span><span class=cF0>;
|
|
<a name="l32"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left + SLIDER_BORDER, c->top + SLIDER_BORDER,
|
|
<a name="l33"></a> SLIDER_SPACING * </span><span class=cFE>3</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> * SLIDER_BORDER,
|
|
<a name="l34"></a> SLIDER_SPACING * </span><span class=cFE>2</span><span class=cF0> + SLIDER_RANGE - </span><span class=cFE>2</span><span class=cF0> * SLIDER_BORDER);
|
|
<a name="l35"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l36"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, c->left + </span><span class=cFE>1</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>0</span><span class=cF0>, c->top + SLIDER_SPACING,
|
|
<a name="l37"></a> c->left + </span><span class=cFE>1</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>0</span><span class=cF0>, c->top + SLIDER_SPACING + SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l38"></a>
|
|
<a name="l39"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, c->left + </span><span class=cFE>2</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>1</span><span class=cF0>, c->top + SLIDER_SPACING,
|
|
<a name="l40"></a> c->left + </span><span class=cFE>2</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>1</span><span class=cF0>, c->top + SLIDER_SPACING + SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l41"></a> dc->color = </span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l42"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + </span><span class=cFE>1</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>0</span><span class=cF0> - </span><span class=cF3>FONT_WIDTH</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l43"></a> c->top + SLIDER_SPACING + SLIDER_RANGE + </span><span class=cFE>3</span><span class=cF0>,
|
|
<a name="l44"></a> </span><span class=cF6>"%d"</span><span class=cF0>, s->left_pos * </span><span class=cFE>10</span><span class=cF0> / SLIDER_RANGE);
|
|
<a name="l45"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + </span><span class=cFE>2</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>1</span><span class=cF0> - </span><span class=cF3>FONT_WIDTH</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l46"></a> c->top + SLIDER_SPACING + SLIDER_RANGE+</span><span class=cFE>3</span><span class=cF0>,
|
|
<a name="l47"></a> </span><span class=cF6>"%d"</span><span class=cF0>, s->right_pos * </span><span class=cFE>10</span><span class=cF0> / SLIDER_RANGE);
|
|
<a name="l48"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left + </span><span class=cFE>1</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>0</span><span class=cF0> - </span><span class=cFE>3</span><span class=cF0>,
|
|
<a name="l49"></a> c->top + SLIDER_SPACING + SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - s->left_pos - </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>7</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0>);
|
|
<a name="l50"></a>
|
|
<a name="l51"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left + </span><span class=cFE>2</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>1</span><span class=cF0> - </span><span class=cFE>3</span><span class=cF0>,
|
|
<a name="l52"></a> c->top + SLIDER_SPACING + SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - s->right_pos - </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>7</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0>);
|
|
<a name="l53"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l54"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left + </span><span class=cFE>1</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>0</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l55"></a> c->top + SLIDER_SPACING + SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - s->left_pos - </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0>, </span><span class=cFE>3</span><span class=cF0>);
|
|
<a name="l56"></a>
|
|
<a name="l57"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left + </span><span class=cFE>2</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>1</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l58"></a> c->top + SLIDER_SPACING + SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - s->right_pos - </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0>, </span><span class=cFE>3</span><span class=cF0>);
|
|
<a name="l59"></a>}
|
|
<a name="l60"></a>
|
|
<a name="l61"></a></span><span class=cF1>U0</span><span class=cF0> UpdateDerivedCtrlSlider(</span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l62"></a>{
|
|
<a name="l63"></a> CSliderState *s = c->state;
|
|
<a name="l64"></a>
|
|
<a name="l65"></a> c->left = c->win_task->pix_width / </span><span class=cFE>2</span><span class=cF0> - (SLIDER_SPACING * </span><span class=cFE>3</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>) / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l66"></a> c->right = c->left + </span><span class=cFE>3</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l67"></a> c->top = c->win_task->pix_height / </span><span class=cFE>2</span><span class=cF0> - (SLIDER_SPACING * </span><span class=cFE>2</span><span class=cF0> + SLIDER_RANGE) / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l68"></a> c->bottom = c->top + SLIDER_SPACING * </span><span class=cFE>2</span><span class=cF0> + SLIDER_RANGE;
|
|
<a name="l69"></a> s->left_pos = </span><span class=cF5>ClampI64</span><span class=cF0>(s->left_pos, </span><span class=cFE>0</span><span class=cF0>, SLIDER_RANGE -</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l70"></a> s->right_pos = </span><span class=cF5>ClampI64</span><span class=cF0>(s->right_pos, </span><span class=cFE>0</span><span class=cF0>, SLIDER_RANGE -</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l71"></a>}
|
|
<a name="l72"></a>
|
|
<a name="l73"></a></span><span class=cF1>U0</span><span class=cF0> LeftClickSlider(</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="l74"></a>{
|
|
<a name="l75"></a> CSliderState *s = c->state;
|
|
<a name="l76"></a>
|
|
<a name="l77"></a> </span><span class=cF1>if</span><span class=cF0> (x < c->left + </span><span class=cFE>1</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>0</span><span class=cF0> + SLIDER_SPACING / </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l78"></a> s->left_pos = SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - (y - </span><span class=cF7>(</span><span class=cF0>c->top + SLIDER_SPACING</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l79"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l80"></a> s->right_pos = SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - (y - </span><span class=cF7>(</span><span class=cF0>c->top + SLIDER_SPACING</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l82"></a> (*c->update_derived_vals)(c);
|
|
<a name="l83"></a>}
|
|
<a name="l84"></a>
|
|
<a name="l85"></a></span><span class=cF9>CCtrl</span><span class=cF0> *SliderNew()
|
|
<a name="l86"></a>{
|
|
<a name="l87"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l88"></a>
|
|
<a name="l89"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0> != </span><span class=cFB>sys_task</span><span class=cF0>)
|
|
<a name="l90"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l91"></a> </span><span class=cF6>"Must be System Included with SHIFT-F5.\n"</span><span class=cF0>
|
|
<a name="l92"></a> </span><span class=cF6>"(Would crash when code mem was freed.)\n"</span><span class=cF0>;
|
|
<a name="l93"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l94"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l95"></a> c = </span><span class=cF5>SysCAlloc</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="l96"></a> c->win_task = </span><span class=cFB>sys_winmgr_task</span><span class=cF0>;
|
|
<a name="l97"></a> c->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="l98"></a> c->type = </span><span class=cF3>CTRLT_GENERIC</span><span class=cF0>;
|
|
<a name="l99"></a> c->state = </span><span class=cF5>SysCAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CSliderState</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l100"></a> c->draw_it = &DrawCtrlSlider;
|
|
<a name="l101"></a> c->left_click = &LeftClickSlider;
|
|
<a name="l102"></a> c->update_derived_vals = &UpdateDerivedCtrlSlider;
|
|
<a name="l103"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(c, </span><span class=cFB>sys_winmgr_task</span><span class=cF0>->last_ctrl);
|
|
<a name="l104"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>;
|
|
<a name="l105"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l106"></a>}
|
|
<a name="l107"></a>
|
|
<a name="l108"></a></span><span class=cF1>U0</span><span class=cF0> SliderDel(</span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l109"></a>{
|
|
<a name="l110"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(c);
|
|
<a name="l111"></a> </span><span class=cF5>Free</span><span class=cF0>(c->state);
|
|
<a name="l112"></a> </span><span class=cF5>Free</span><span class=cF0>(c);
|
|
<a name="l113"></a>}
|
|
<a name="l114"></a>
|
|
<a name="l115"></a>SliderNew;
|
|
</span></pre></body>
|
|
</html>
|