mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-31 17:56:30 +00:00
1b75d91002
Add arg to SATARep to specify drive types to show. Add checks in AHCIPortInit to verify port signatures, add helper method to get signatures from port.
439 lines
55 KiB
HTML
Executable file
439 lines
55 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.13">
|
|
<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>public</span><span class=cF0> </span><span class=cF9>CCtrl</span><span class=cF0> *</span><span class=cF5>CtrlFindUnique</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *haystack_task, </span><span class=cF9>I64</span><span class=cF0> needle_type)
|
|
<a name="l2"></a>{</span><span class=cF2>//Find task ctrl given </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3752"><span class=cF4>ctrl_type</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l3"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l4"></a>
|
|
<a name="l5"></a> c = haystack_task->next_ctrl;
|
|
<a name="l6"></a> </span><span class=cF1>while</span><span class=cF0> (c != &haystack_task->next_ctrl)
|
|
<a name="l7"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l8"></a> </span><span class=cF1>if</span><span class=cF0> (c->type == needle_type)
|
|
<a name="l9"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l10"></a> c = c->next;
|
|
<a name="l11"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l12"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l13"></a>}
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>CtrlsUpdate</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task)
|
|
<a name="l16"></a>{
|
|
<a name="l17"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l18"></a>
|
|
<a name="l19"></a> c = task->next_ctrl;
|
|
<a name="l20"></a> </span><span class=cF1>while</span><span class=cF0> (c != &task->next_ctrl)
|
|
<a name="l21"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l23"></a> (*c->update_derived_vals)(c);
|
|
<a name="l24"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags & </span><span class=cF3>CTRLF_BORDER</span><span class=cF0>)
|
|
<a name="l25"></a> {
|
|
<a name="l26"></a> c->screen_left = </span><span class=cFB>gr</span><span class=cF0>.pan_text_x + task->pix_left + c->left - </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
|
|
<a name="l27"></a> c->screen_right = </span><span class=cFB>gr</span><span class=cF0>.pan_text_x + task->pix_left + c->right - </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
|
|
<a name="l28"></a> c->screen_top = </span><span class=cFB>gr</span><span class=cF0>.pan_text_y + task->pix_top + c->top - </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
|
|
<a name="l29"></a> c->screen_bottom = </span><span class=cFB>gr</span><span class=cF0>.pan_text_y + task->pix_top + c->bottom - </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
|
|
<a name="l30"></a> }
|
|
<a name="l31"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l32"></a> {
|
|
<a name="l33"></a> c->screen_left = </span><span class=cFB>gr</span><span class=cF0>.pan_text_x + task->pix_left + c->left;
|
|
<a name="l34"></a> c->screen_right = </span><span class=cFB>gr</span><span class=cF0>.pan_text_x + task->pix_left + c->right;
|
|
<a name="l35"></a> c->screen_top = </span><span class=cFB>gr</span><span class=cF0>.pan_text_y + task->pix_top + c->top;
|
|
<a name="l36"></a> c->screen_bottom = </span><span class=cFB>gr</span><span class=cF0>.pan_text_y + task->pix_top + c->bottom;
|
|
<a name="l37"></a> }
|
|
<a name="l38"></a> c = c->next;
|
|
<a name="l39"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l40"></a>}
|
|
<a name="l41"></a>
|
|
<a name="l42"></a></span><span class=cFB>fp_update_ctrls</span><span class=cF0> = &</span><span class=cF5>CtrlsUpdate</span><span class=cF0>;
|
|
<a name="l43"></a>
|
|
<a name="l44"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>CtrlInsideRect</span><span class=cF0>(</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)
|
|
<a name="l45"></a>{</span><span class=cF2>//screen coordinates</span><span class=cF0>
|
|
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (c->screen_left <= x <= c->screen_right && c->screen_top <= y <= c->screen_bottom)
|
|
<a name="l47"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l48"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l49"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l50"></a>}
|
|
<a name="l51"></a>
|
|
<a name="l52"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>CtrlInside</span><span class=cF0>(</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)
|
|
<a name="l53"></a>{</span><span class=cF2>//Is x, y inside a ctrl?</span><span class=cF0>
|
|
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags & </span><span class=cF3>CTRLF_SHOW</span><span class=cF0>)
|
|
<a name="l55"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (c->inside_ctrl)
|
|
<a name="l57"></a> </span><span class=cF1>return</span><span class=cF0> (*c->inside_ctrl)(c, x, y);
|
|
<a name="l58"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l59"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>CtrlInsideRect</span><span class=cF0>(c, x, y);
|
|
<a name="l60"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l61"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l62"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l63"></a>}
|
|
<a name="l64"></a>
|
|
<a name="l65"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawCtrls</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task)
|
|
<a name="l66"></a>{
|
|
<a name="l67"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l68"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc2, task);
|
|
<a name="l69"></a>
|
|
<a name="l70"></a> c = task->next_ctrl;
|
|
<a name="l71"></a> </span><span class=cF1>while</span><span class=cF0> (c != &task->next_ctrl)
|
|
<a name="l72"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags & </span><span class=cF3>CTRLF_SHOW</span><span class=cF0>)
|
|
<a name="l74"></a> {
|
|
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags & </span><span class=cF3>CTRLF_BORDER</span><span class=cF0>)
|
|
<a name="l76"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l77"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&task->display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l78"></a> {
|
|
<a name="l79"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
|
<a name="l80"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
|
<a name="l81"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&task->task_flags, </span><span class=cF3>TASKf_TASK_LOCK</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l82"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
|
<a name="l83"></a>
|
|
<a name="l84"></a> task->win_left--; </span><span class=cF2>//Allow drawing on border</span><span class=cF0>
|
|
<a name="l85"></a> task->win_right++;
|
|
<a name="l86"></a> task->win_top--;
|
|
<a name="l87"></a> task->win_bottom++;
|
|
<a name="l88"></a> </span><span class=cF5>WinDerivedValsUpdate</span><span class=cF0>(task);
|
|
<a name="l89"></a>
|
|
<a name="l90"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->task_flags, </span><span class=cF3>TASKf_TASK_LOCK</span><span class=cF0>);
|
|
<a name="l91"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
|
<a name="l92"></a>
|
|
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (c->draw_it)
|
|
<a name="l94"></a> (*c->draw_it)(dc, c);
|
|
<a name="l95"></a>
|
|
<a name="l96"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
|
<a name="l97"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
|
<a name="l98"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&task->task_flags, </span><span class=cF3>TASKf_TASK_LOCK</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l99"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
|
<a name="l100"></a>
|
|
<a name="l101"></a> task->win_left++;
|
|
<a name="l102"></a> task->win_right--;
|
|
<a name="l103"></a> task->win_top++;
|
|
<a name="l104"></a> task->win_bottom--;
|
|
<a name="l105"></a> </span><span class=cF5>WinDerivedValsUpdate</span><span class=cF0>(task);
|
|
<a name="l106"></a>
|
|
<a name="l107"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->task_flags, </span><span class=cF3>TASKf_TASK_LOCK</span><span class=cF0>);
|
|
<a name="l108"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
|
<a name="l109"></a> }
|
|
<a name="l110"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l111"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (c->draw_it)
|
|
<a name="l113"></a> (*c->draw_it)(dc, c);
|
|
<a name="l114"></a> }
|
|
<a name="l115"></a> c = c->next;
|
|
<a name="l116"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l117"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l118"></a>}
|
|
<a name="l119"></a>
|
|
<a name="l120"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0> </span><span class=cFE>8</span><span class=cF0>
|
|
<a name="l121"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0> </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l122"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawWinScroll</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l123"></a>{
|
|
<a name="l124"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *s = c->state;
|
|
<a name="l125"></a>
|
|
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags & </span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>)
|
|
<a name="l127"></a> dc->color = s->color >> </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l128"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l129"></a> dc->color = s->color & </span><span class=cFE>0xF</span><span class=cF0>;
|
|
<a name="l130"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>GrRect(dc, c->left, c->top, c->right - c->left + 1, c->bottom - c->top + 1);</span><span class=cF0>
|
|
<a name="l131"></a> </span><span class=cF5>GrPutS</span><span class=cF0>(dc, c->left, c->top, </span><span class=cF6>"."</span><span class=cF0>);
|
|
<a name="l132"></a>
|
|
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags & </span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>)
|
|
<a name="l134"></a> dc->color = s->color & </span><span class=cFE>0xF</span><span class=cF0>;
|
|
<a name="l135"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l136"></a> dc->color = s->color >> </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l137"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>GrRect(dc, c->left + 2, c->top + 2, c->right - c->left + 1 - 4, c->bottom - c->top + 1 - 4);</span><span class=cF0>
|
|
<a name="l138"></a> </span><span class=cF5>GrPutS</span><span class=cF0>(dc, c->left, c->top, </span><span class=cF6>"."</span><span class=cF0>);
|
|
<a name="l139"></a>
|
|
<a name="l140"></a>}
|
|
<a name="l141"></a>
|
|
<a name="l142"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinDerivedScrollValsUpdate</span><span class=cF0>(</span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l143"></a>{
|
|
<a name="l144"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *s = c->state;
|
|
<a name="l145"></a> </span><span class=cF9>I64</span><span class=cF0> range;
|
|
<a name="l146"></a>
|
|
<a name="l147"></a> </span><span class=cF1>if</span><span class=cF0> (s->max < s->min) s->max = s->min;
|
|
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (s->pos < s->min) s->pos = s->min;
|
|
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (s->pos > s->max) s->pos = s->max;
|
|
<a name="l150"></a>
|
|
<a name="l151"></a> s->color = c->win_task->border_attr & </span><span class=cFE>0xF</span><span class=cF0> ^ </span><span class=cFE>0xF</span><span class=cF0> + (c->win_task->border_attr & </span><span class=cFE>0xF</span><span class=cF0>) << </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l152"></a> range = s->max - s->min;
|
|
<a name="l153"></a> </span><span class=cF1>if</span><span class=cF0> (!range)
|
|
<a name="l154"></a> range = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l155"></a> </span><span class=cF1>switch</span><span class=cF0> (c->type)
|
|
<a name="l156"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l157"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CTRLT_WIN_HSCROLL</span><span class=cF0>:
|
|
<a name="l158"></a> c->left = </span><span class=cFB>gr</span><span class=cF0>.pan_text_x + </span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0> +
|
|
<a name="l159"></a> (s->pos - s->min) * (c->win_task->pix_width + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>) / range;
|
|
<a name="l160"></a> c->right = c->left + </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l161"></a> c->top = </span><span class=cFB>gr</span><span class=cF0>.pan_text_y + </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> + (</span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>) / </span><span class=cFE>2</span><span class=cF0> + c->win_task->pix_height;
|
|
<a name="l162"></a> c->bottom = c->top + </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l163"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l164"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CTRLT_WIN_VSCROLL</span><span class=cF0>:
|
|
<a name="l165"></a> c->left = </span><span class=cFB>gr</span><span class=cF0>.pan_text_x + </span><span class=cF3>FONT_WIDTH</span><span class=cF0> + (</span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>) / </span><span class=cFE>2</span><span class=cF0> + c->win_task->pix_width;
|
|
<a name="l166"></a> c->right = c->left + </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l167"></a> c->top = </span><span class=cFB>gr</span><span class=cF0>.pan_text_y + </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0>+
|
|
<a name="l168"></a> (s->pos - s->min) * (c->win_task->pix_height + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>) / range;
|
|
<a name="l169"></a> c->bottom = c->top + </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l170"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l171"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l172"></a>}
|
|
<a name="l173"></a>
|
|
<a name="l174"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>LeftClickHWinScroll</span><span class=cF0>(</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>, </span><span class=cF1>Bool</span><span class=cF0> down)
|
|
<a name="l175"></a>{
|
|
<a name="l176"></a> </span><span class=cF9>CTask</span><span class=cF0> *task = c->win_task;
|
|
<a name="l177"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *s = c->state;
|
|
<a name="l178"></a> </span><span class=cF9>I64</span><span class=cF0> range = task->pix_width + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>;
|
|
<a name="l179"></a>
|
|
<a name="l180"></a> </span><span class=cF5>LBts</span><span class=cF0>(&s->flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF0>);
|
|
<a name="l181"></a> s->pos = (</span><span class=cF7>(</span><span class=cF0>x - (</span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>
|
|
<a name="l182"></a> *</span><span class=cF7>(</span><span class=cF0>s->max - s->min + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> + range / </span><span class=cFE>2</span><span class=cF0>) / range + s->min;
|
|
<a name="l183"></a> </span><span class=cF1>if</span><span class=cF0> (down)
|
|
<a name="l184"></a> c->flags |= </span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>;
|
|
<a name="l185"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l186"></a> c->flags &= ~</span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>;
|
|
<a name="l187"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l188"></a> (*c->update_derived_vals)(c);
|
|
<a name="l189"></a>}
|
|
<a name="l190"></a>
|
|
<a name="l191"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>LeftClickVWinScroll</span><span class=cF0>(</span><span class=cF9>CCtrl</span><span class=cF0> *c, </span><span class=cF9>I64</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF1>Bool</span><span class=cF0> down)
|
|
<a name="l192"></a>{
|
|
<a name="l193"></a> </span><span class=cF9>CTask</span><span class=cF0> *task = c->win_task;
|
|
<a name="l194"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *s = c->state;
|
|
<a name="l195"></a> </span><span class=cF9>I64</span><span class=cF0> range = task->pix_height + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>;
|
|
<a name="l196"></a>
|
|
<a name="l197"></a> </span><span class=cF5>LBts</span><span class=cF0>(&s->flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF0>);
|
|
<a name="l198"></a> s->pos = (</span><span class=cF7>(</span><span class=cF0>y - (</span><span class=cF3>FONT_HEIGHT</span><span class=cF0> - </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>
|
|
<a name="l199"></a> *</span><span class=cF7>(</span><span class=cF0>s->max - s->min + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> + range / </span><span class=cFE>2</span><span class=cF0>) / range + s->min;
|
|
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (down)
|
|
<a name="l201"></a> c->flags |= </span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>;
|
|
<a name="l202"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l203"></a> c->flags &= ~</span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>;
|
|
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l205"></a> (*c->update_derived_vals)(c);
|
|
<a name="l206"></a>}
|
|
<a name="l207"></a>
|
|
<a name="l208"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WheelChangeWinScroll</span><span class=cF0>(</span><span class=cF9>CCtrl</span><span class=cF0> *c, </span><span class=cF9>I64</span><span class=cF0> delta)
|
|
<a name="l209"></a>{
|
|
<a name="l210"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *s = c->state;
|
|
<a name="l211"></a>
|
|
<a name="l212"></a> </span><span class=cF5>LBts</span><span class=cF0>(&s->flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF0>);
|
|
<a name="l213"></a> s->pos += delta;
|
|
<a name="l214"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l215"></a> (*c->update_derived_vals)(c);
|
|
<a name="l216"></a>}
|
|
<a name="l217"></a>
|
|
<a name="l218"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinScrollsInit</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task)
|
|
<a name="l219"></a>{
|
|
<a name="l220"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l221"></a>
|
|
<a name="l222"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>CtrlFindUnique</span><span class=cF7>(</span><span class=cF0>task, </span><span class=cF3>CTRLT_WIN_HSCROLL</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l223"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l224"></a> 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="l225"></a> c->win_task = task;
|
|
<a name="l226"></a> c->flags = </span><span class=cF3>CTRLF_SHOW</span><span class=cF0> | </span><span class=cF3>CTRLF_BORDER</span><span class=cF0> | </span><span class=cF3>CTRLF_CAPTURE_LEFT_MS</span><span class=cF0>;
|
|
<a name="l227"></a> c->type = </span><span class=cF3>CTRLT_WIN_HSCROLL</span><span class=cF0>;
|
|
<a name="l228"></a> c->state = &task->horz_scroll;
|
|
<a name="l229"></a> c->update_derived_vals = &</span><span class=cF5>WinDerivedScrollValsUpdate</span><span class=cF0>;
|
|
<a name="l230"></a> c->draw_it = &</span><span class=cF5>DrawWinScroll</span><span class=cF0>;
|
|
<a name="l231"></a> c->left_click = &</span><span class=cF5>LeftClickHWinScroll</span><span class=cF0>;
|
|
<a name="l232"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(c, task->last_ctrl);
|
|
<a name="l233"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l234"></a>
|
|
<a name="l235"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>CtrlFindUnique</span><span class=cF7>(</span><span class=cF0>task, </span><span class=cF3>CTRLT_WIN_VSCROLL</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l236"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l237"></a> 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="l238"></a> c->win_task=task;
|
|
<a name="l239"></a> c->flags = </span><span class=cF3>CTRLF_SHOW</span><span class=cF0> | </span><span class=cF3>CTRLF_BORDER</span><span class=cF0> | </span><span class=cF3>CTRLF_CAPTURE_LEFT_MS</span><span class=cF0>;
|
|
<a name="l240"></a> c->type = </span><span class=cF3>CTRLT_WIN_VSCROLL</span><span class=cF0>;
|
|
<a name="l241"></a> c->state = &task->vert_scroll;
|
|
<a name="l242"></a> c->update_derived_vals = &</span><span class=cF5>WinDerivedScrollValsUpdate</span><span class=cF0>;
|
|
<a name="l243"></a> c->draw_it = &</span><span class=cF5>DrawWinScroll</span><span class=cF0>;
|
|
<a name="l244"></a> c->left_click = &</span><span class=cF5>LeftClickVWinScroll</span><span class=cF0>;
|
|
<a name="l245"></a> c->wheel_chg = &</span><span class=cF5>WheelChangeWinScroll</span><span class=cF0>;
|
|
<a name="l246"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(c, task->last_ctrl);
|
|
<a name="l247"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l248"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task);
|
|
<a name="l249"></a>}
|
|
<a name="l250"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> </span><span class=cFE>22</span><span class=cF0>
|
|
<a name="l251"></a></span><span class=cF2>//#define VIEWANGLES_RANGE</span><span class=cF0> </span><span class=cF2>48</span><span class=cF0>
|
|
<a name="l252"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> </span><span class=cFE>360</span><span class=cF0>
|
|
<a name="l253"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VIEWANGLES_BORDER</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l254"></a></span><span class=cF2>//#define VIEWANGLES_SNAP</span><span class=cF0> </span><span class=cF2>2</span><span class=cF0>
|
|
<a name="l255"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VIEWANGLES_SNAP</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l256"></a>
|
|
<a name="l257"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawViewAnglesCtrl</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l258"></a>{
|
|
<a name="l259"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
|
|
<a name="l260"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s = c->state;
|
|
<a name="l261"></a>
|
|
<a name="l262"></a> dc->color = s->cbd;
|
|
<a name="l263"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left, c->top, </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> * </span><span class=cFE>4</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0>, </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l264"></a> dc->color = s->cbg;
|
|
<a name="l265"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left + </span><span class=cF3>VIEWANGLES_BORDER</span><span class=cF0>, c->top + </span><span class=cF3>VIEWANGLES_BORDER</span><span class=cF0>,
|
|
<a name="l266"></a> </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> * </span><span class=cFE>4</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_BORDER</span><span class=cF0>,
|
|
<a name="l267"></a> </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_BORDER</span><span class=cF0>);
|
|
<a name="l268"></a> dc->color = s->config;
|
|
<a name="l269"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, c->left + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>, c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>,
|
|
<a name="l270"></a> c->left + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>, c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l271"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, c->left + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>, c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>,
|
|
<a name="l272"></a> c->left + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>, c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l273"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, c->left + </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>, c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>,
|
|
<a name="l274"></a> c->left + </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>, c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l275"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i < </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>; i += </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SNAP</span><span class=cF0>)
|
|
<a name="l276"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l277"></a> j = </span><span class=cFE>2</span><span class=cF0> - i / </span><span class=cFE>3</span><span class=cF0> & </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l278"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, c->left + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - j, c->bottom - </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - i,
|
|
<a name="l279"></a> c->left + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + j, c->bottom - </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - i);
|
|
<a name="l280"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, c->left + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> - j, c->bottom - </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - i,
|
|
<a name="l281"></a> c->left + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> + j, c->bottom - </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - i);
|
|
<a name="l282"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, c->left + </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0> - j, c->bottom - </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - i,
|
|
<a name="l283"></a> c->left + </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0> + j, c->bottom - </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - i);
|
|
<a name="l284"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l285"></a>
|
|
<a name="l286"></a> dc->color = s->cx;
|
|
<a name="l287"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + </span><span class=cF3>VIEWANGLES_SPACING</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="l288"></a> c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - </span><span class=cF7>(</span><span class=cFE>1</span><span class=cF0> + </span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF6>"X"</span><span class=cF0>);
|
|
<a name="l289"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - </span><span class=cFE>3</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="l290"></a> c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0>, </span><span class=cF6>"%3d"</span><span class=cF0>, s->sx * </span><span class=cFE>360</span><span class=cF0> / </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l291"></a> i = c->left + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>;
|
|
<a name="l292"></a> </span><span class=cF1>if</span><span class=cF0> (s->sx > </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l293"></a> j = -</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> + s->sx;
|
|
<a name="l294"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l295"></a> j = s->sx + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l296"></a> j = c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0> - j;
|
|
<a name="l297"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, i - </span><span class=cFE>3</span><span class=cF0>, j - </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="l298"></a> dc->color = s->cx ^ </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l299"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, i - </span><span class=cFE>2</span><span class=cF0>, j - </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="l300"></a>
|
|
<a name="l301"></a> dc->color = s->cy;
|
|
<a name="l302"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </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="l303"></a> c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - </span><span class=cF7>(</span><span class=cFE>1</span><span class=cF0> + </span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF6>"Y"</span><span class=cF0>);
|
|
<a name="l304"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> - </span><span class=cFE>3</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="l305"></a> c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0>, </span><span class=cF6>"%3d"</span><span class=cF0>, s->sy * </span><span class=cFE>360</span><span class=cF0> / </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l306"></a> i = c->left + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l307"></a> </span><span class=cF1>if</span><span class=cF0> (s->sy > </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l308"></a> j = -</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> + s->sy;
|
|
<a name="l309"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l310"></a> j = s->sy + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l311"></a> j = c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0> - j;
|
|
<a name="l312"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, i - </span><span class=cFE>3</span><span class=cF0>, j - </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="l313"></a> dc->color = s->cy ^ </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l314"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, i - </span><span class=cFE>2</span><span class=cF0>, j - </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="l315"></a>
|
|
<a name="l316"></a> dc->color = s->cz;
|
|
<a name="l317"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>2</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="l318"></a> c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> - </span><span class=cF7>(</span><span class=cFE>1</span><span class=cF0> + </span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF6>"Z"</span><span class=cF0>);
|
|
<a name="l319"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>3</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="l320"></a> c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0>, </span><span class=cF6>"%3d"</span><span class=cF0>, s->sz * </span><span class=cFE>360</span><span class=cF0> / </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l321"></a> i = c->left + </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l322"></a> </span><span class=cF1>if</span><span class=cF0> (s->sz > </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l323"></a> j = -</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> + s->sz;
|
|
<a name="l324"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l325"></a> j = s->sz + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l326"></a> j = c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0> - j;
|
|
<a name="l327"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, i - </span><span class=cFE>3</span><span class=cF0>, j - </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="l328"></a> dc->color = s->cz ^ </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l329"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, i - </span><span class=cFE>2</span><span class=cF0>, j - </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="l330"></a>}
|
|
<a name="l331"></a>
|
|
<a name="l332"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>UpdateDerivedViewAnglesCtrl</span><span class=cF0>(</span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l333"></a>{
|
|
<a name="l334"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s = c->state;
|
|
<a name="l335"></a>
|
|
<a name="l336"></a> c->left = c->win_task->pix_width - (</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> * </span><span class=cFE>4</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0>);
|
|
<a name="l337"></a> c->right = c->left + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> * </span><span class=cFE>4</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l338"></a> c->top = c->win_task->pix_height - (</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l339"></a> c->bottom = c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> + </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>;
|
|
<a name="l340"></a> s->sx = </span><span class=cF5>ClampI64</span><span class=cF0>(</span><span class=cF5>RoundI64</span><span class=cF7>(</span><span class=cF0>s->sx, </span><span class=cF3>VIEWANGLES_SNAP</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l341"></a> s->sy = </span><span class=cF5>ClampI64</span><span class=cF0>(</span><span class=cF5>RoundI64</span><span class=cF7>(</span><span class=cF0>s->sy, </span><span class=cF3>VIEWANGLES_SNAP</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l342"></a> s->sz = </span><span class=cF5>ClampI64</span><span class=cF0>(</span><span class=cF5>RoundI64</span><span class=cF7>(</span><span class=cF0>s->sz, </span><span class=cF3>VIEWANGLES_SNAP</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l343"></a> s->ax = </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> * s->sx / </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>;
|
|
<a name="l344"></a> s->ay = </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> * s->sy / </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>;
|
|
<a name="l345"></a> s->az = </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> * s->sz / </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>;
|
|
<a name="l346"></a>}
|
|
<a name="l347"></a>
|
|
<a name="l348"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>LeftClickViewAngles</span><span class=cF0>(</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="l349"></a>{
|
|
<a name="l350"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s = c->state;
|
|
<a name="l351"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l352"></a>
|
|
<a name="l353"></a> i = </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0> - (y - </span><span class=cF7>(</span><span class=cF0>c->top + </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l354"></a> </span><span class=cF1>if</span><span class=cF0> (i >= </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l355"></a> i -= </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l356"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l357"></a> i += </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l358"></a> </span><span class=cF1>if</span><span class=cF0> (x < c->left + </span><span class=cF7>(</span><span class=cF0>c->right - c->left</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l359"></a> s->sx = i;
|
|
<a name="l360"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (x < c->left + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF0>c->right - c->left</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l361"></a> s->sy = i;
|
|
<a name="l362"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l363"></a> s->sz = i;
|
|
<a name="l364"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l365"></a> (*c->update_derived_vals)(c);
|
|
<a name="l366"></a>}
|
|
<a name="l367"></a>
|
|
<a name="l368"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CCtrl</span><span class=cF0> *</span><span class=cF5>ViewAnglesNew</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l369"></a>{</span><span class=cF2>//Create view angle ctrl. See </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Graphics/Shading.CC.html#l1"><span class=cF4>::/Demo/Graphics/Shading.CC</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l370"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l371"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s;
|
|
<a name="l372"></a>
|
|
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
|
|
<a name="l374"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
<a name="l375"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>c = </span><span class=cF5>CtrlFindUnique</span><span class=cF0>(task, </span><span class=cF3>CTRLT_VIEWING_ANGLES</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l376"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l377"></a> s = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CViewAngles</span><span class=cF7>)</span><span class=cF0>, task);
|
|
<a name="l378"></a> 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="l379"></a> s->cbd = </span><span class=cF3>BLUE</span><span class=cF0>;
|
|
<a name="l380"></a> s->cbg = </span><span class=cF3>LTBLUE</span><span class=cF0>;
|
|
<a name="l381"></a> s->config = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l382"></a> s->cx = </span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l383"></a> s->cy = </span><span class=cF3>GREEN</span><span class=cF0>;
|
|
<a name="l384"></a> s->cz = </span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l385"></a> c->win_task = task;
|
|
<a name="l386"></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="l387"></a> c->type = </span><span class=cF3>CTRLT_VIEWING_ANGLES</span><span class=cF0>;
|
|
<a name="l388"></a> c->state = s;
|
|
<a name="l389"></a> c->draw_it = &</span><span class=cF5>DrawViewAnglesCtrl</span><span class=cF0>;
|
|
<a name="l390"></a> c->left_click = &</span><span class=cF5>LeftClickViewAngles</span><span class=cF0>;
|
|
<a name="l391"></a> c->update_derived_vals = &</span><span class=cF5>UpdateDerivedViewAnglesCtrl</span><span class=cF0>;
|
|
<a name="l392"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(c, task->last_ctrl);
|
|
<a name="l393"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task);
|
|
<a name="l394"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l395"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l396"></a>}
|
|
<a name="l397"></a>
|
|
<a name="l398"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ViewAnglesDel</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l399"></a>{</span><span class=cF2>//Free view angle ctrl.</span><span class=cF0>
|
|
<a name="l400"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l401"></a>
|
|
<a name="l402"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
|
|
<a name="l403"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
<a name="l404"></a> </span><span class=cF1>if</span><span class=cF0> (c = </span><span class=cF5>CtrlFindUnique</span><span class=cF7>(</span><span class=cF0>task, </span><span class=cF3>CTRLT_VIEWING_ANGLES</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l405"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l406"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(c);
|
|
<a name="l407"></a> </span><span class=cF5>Free</span><span class=cF0>(c->state);
|
|
<a name="l408"></a> </span><span class=cF5>Free</span><span class=cF0>(c);
|
|
<a name="l409"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l410"></a>}
|
|
</span></pre></body>
|
|
</html>
|