420 lines
44 KiB
HTML
Executable File
420 lines
44 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<a name="l1"></a><span class=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="/Wb/Kernel/KernelA.HH.HTML#l3041"><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> c=haystack_task->next_ctrl;
|
|
<a name="l5"></a> </span><span class=cF1>while</span><span class=cF0> (c!=&haystack_task->next_ctrl) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (c->type==needle_type)
|
|
<a name="l7"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l8"></a> c=c->next;
|
|
<a name="l9"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l10"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l11"></a>}
|
|
<a name="l12"></a>
|
|
<a name="l13"></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="l14"></a>{
|
|
<a name="l15"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l16"></a> c=task->next_ctrl;
|
|
<a name="l17"></a> </span><span class=cF1>while</span><span class=cF0> (c!=&task->next_ctrl) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l19"></a> (*c->update_derived_vals)(c);
|
|
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags&</span><span class=cF3>CTRLF_BORDER</span><span class=cF0>) {
|
|
<a name="l21"></a> c->scrn_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="l22"></a> c->scrn_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="l23"></a> c->scrn_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="l24"></a> c->scrn_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="l25"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l26"></a> c->scrn_left =</span><span class=cFB>gr</span><span class=cF0>.pan_text_x+task->pix_left+c->left;
|
|
<a name="l27"></a> c->scrn_right =</span><span class=cFB>gr</span><span class=cF0>.pan_text_x+task->pix_left+c->right;
|
|
<a name="l28"></a> c->scrn_top =</span><span class=cFB>gr</span><span class=cF0>.pan_text_y+task->pix_top+c->top;
|
|
<a name="l29"></a> c->scrn_bottom=</span><span class=cFB>gr</span><span class=cF0>.pan_text_y+task->pix_top+c->bottom;
|
|
<a name="l30"></a> }
|
|
<a name="l31"></a> c=c->next;
|
|
<a name="l32"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l33"></a>}
|
|
<a name="l34"></a>
|
|
<a name="l35"></a></span><span class=cFB>fp_update_ctrls</span><span class=cF0>=&</span><span class=cF5>CtrlsUpdate</span><span class=cF0>;
|
|
<a name="l36"></a>
|
|
<a name="l37"></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="l38"></a>{</span><span class=cF2>//scrn coordinates</span><span class=cF0>
|
|
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (c->scrn_left<=x<=c->scrn_right &&
|
|
<a name="l40"></a> c->scrn_top<=y<=c->scrn_bottom)
|
|
<a name="l41"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l42"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l43"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l44"></a>}
|
|
<a name="l45"></a>
|
|
<a name="l46"></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="l47"></a>{</span><span class=cF2>//Is x,y inside a ctrl?</span><span class=cF0>
|
|
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags&</span><span class=cF3>CTRLF_SHOW</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (c->inside_ctrl)
|
|
<a name="l50"></a> </span><span class=cF1>return</span><span class=cF0> (*c->inside_ctrl)(c,x,y);
|
|
<a name="l51"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l52"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>CtrlInsideRect</span><span class=cF0>(c,x,y);
|
|
<a name="l53"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l54"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l55"></a>}
|
|
<a name="l56"></a>
|
|
<a name="l57"></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="l58"></a>{
|
|
<a name="l59"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l60"></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="l61"></a> c=task->next_ctrl;
|
|
<a name="l62"></a> </span><span class=cF1>while</span><span class=cF0> (c!=&task->next_ctrl) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l63"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags&</span><span class=cF3>CTRLF_SHOW</span><span class=cF0>) {
|
|
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags&</span><span class=cF3>CTRLF_BORDER</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l65"></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="l66"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
|
<a name="l67"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
|
<a name="l68"></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="l69"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
|
<a name="l70"></a>
|
|
<a name="l71"></a> task->win_left--; </span><span class=cF2>//Allow drawing on border</span><span class=cF0>
|
|
<a name="l72"></a> task->win_right++;
|
|
<a name="l73"></a> task->win_top--;
|
|
<a name="l74"></a> task->win_bottom++;
|
|
<a name="l75"></a> </span><span class=cF5>WinDerivedValsUpdate</span><span class=cF0>(task);
|
|
<a name="l76"></a>
|
|
<a name="l77"></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="l78"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
|
<a name="l79"></a>
|
|
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (c->draw_it)
|
|
<a name="l81"></a> (*c->draw_it)(dc,c);
|
|
<a name="l82"></a>
|
|
<a name="l83"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
|
<a name="l84"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
|
<a name="l85"></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="l86"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
|
<a name="l87"></a>
|
|
<a name="l88"></a> task->win_left++;
|
|
<a name="l89"></a> task->win_right--;
|
|
<a name="l90"></a> task->win_top++;
|
|
<a name="l91"></a> task->win_bottom--;
|
|
<a name="l92"></a> </span><span class=cF5>WinDerivedValsUpdate</span><span class=cF0>(task);
|
|
<a name="l93"></a>
|
|
<a name="l94"></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="l95"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
|
<a name="l96"></a> }
|
|
<a name="l97"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l98"></a> </span><span class=cF1>if</span><span class=cF0> (c->draw_it)
|
|
<a name="l99"></a> (*c->draw_it)(dc,c);
|
|
<a name="l100"></a> }
|
|
<a name="l101"></a> c=c->next;
|
|
<a name="l102"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l103"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l104"></a>}
|
|
<a name="l105"></a>
|
|
<a name="l106"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0> 8
|
|
<a name="l107"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0> 4
|
|
<a name="l108"></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="l109"></a>{
|
|
<a name="l110"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *s=c->state;
|
|
<a name="l111"></a>
|
|
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags&</span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>)
|
|
<a name="l113"></a> dc->color=s->color>>4;
|
|
<a name="l114"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l115"></a> dc->color=s->color&0xF;
|
|
<a name="l116"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,c->left,c->top,c->right-c->left+1,c->bottom-c->top+1);
|
|
<a name="l117"></a>
|
|
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (c->flags&</span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>)
|
|
<a name="l119"></a> dc->color=s->color&0xF;
|
|
<a name="l120"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l121"></a> dc->color=s->color>>4;
|
|
<a name="l122"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,c->left+2,c->top+2,c->right-c->left+1-4,c->bottom-c->top+1-4);
|
|
<a name="l123"></a>}
|
|
<a name="l124"></a>
|
|
<a name="l125"></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="l126"></a>{
|
|
<a name="l127"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *s=c->state;
|
|
<a name="l128"></a> </span><span class=cF9>I64</span><span class=cF0> range;
|
|
<a name="l129"></a> </span><span class=cF1>if</span><span class=cF0> (s->max<s->min) s->max=s->min;
|
|
<a name="l130"></a> </span><span class=cF1>if</span><span class=cF0> (s->pos<s->min) s->pos=s->min;
|
|
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (s->pos>s->max) s->pos=s->max;
|
|
<a name="l132"></a> s->color=c->win_task->border_attr&0xF^0xF+
|
|
<a name="l133"></a> (c->win_task->border_attr&0xF)<<4;
|
|
<a name="l134"></a> range=s->max-s->min;
|
|
<a name="l135"></a> </span><span class=cF1>if</span><span class=cF0> (!range) range=1;
|
|
<a name="l136"></a> </span><span class=cF1>switch</span><span class=cF0> (c->type) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l137"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CTRLT_WIN_HSCROLL</span><span class=cF0>:
|
|
<a name="l138"></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="l139"></a> (s->pos-s->min)*(c->win_task->pix_width+2*</span><span class=cF3>WIN_SCROLL_BORDER_BONUS</span><span class=cF0>
|
|
<a name="l140"></a> -</span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>)/range;
|
|
<a name="l141"></a> c->right =c->left+</span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>-1;
|
|
<a name="l142"></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>+
|
|
<a name="l143"></a> (</span><span class=cF3>FONT_WIDTH</span><span class=cF0>-</span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>)/2+c->win_task->pix_height;
|
|
<a name="l144"></a> c->bottom=c->top+</span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>-1;
|
|
<a name="l145"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l146"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CTRLT_WIN_VSCROLL</span><span class=cF0>:
|
|
<a name="l147"></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>+
|
|
<a name="l148"></a> (</span><span class=cF3>FONT_WIDTH</span><span class=cF0>-</span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>)/2+c->win_task->pix_width;
|
|
<a name="l149"></a> c->right =c->left+</span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>-1;
|
|
<a name="l150"></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="l151"></a> (s->pos-s->min)*(c->win_task->pix_height+
|
|
<a name="l152"></a> 2*</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="l153"></a> c->bottom=c->top+</span><span class=cF3>WIN_SCROLL_SIZE</span><span class=cF0>-1;
|
|
<a name="l154"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l155"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l156"></a>}
|
|
<a name="l157"></a>
|
|
<a name="l158"></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="l159"></a>{
|
|
<a name="l160"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=c->win_task;
|
|
<a name="l161"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *s=c->state;
|
|
<a name="l162"></a> </span><span class=cF9>I64</span><span class=cF0> range=task->pix_width+2*</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="l163"></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="l164"></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="l165"></a> *</span><span class=cF7>(</span><span class=cF0>s->max-s->min+1</span><span class=cF7>)</span><span class=cF0>+range/2)/range+s->min;
|
|
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (down)
|
|
<a name="l167"></a> c->flags|=</span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>;
|
|
<a name="l168"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l169"></a> c->flags&=~</span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>;
|
|
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l171"></a> (*c->update_derived_vals)(c);
|
|
<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>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="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_height+2*</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> </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="l180"></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="l181"></a> *</span><span class=cF7>(</span><span class=cF0>s->max-s->min+1</span><span class=cF7>)</span><span class=cF0>+range/2)/range+s->min;
|
|
<a name="l182"></a> </span><span class=cF1>if</span><span class=cF0> (down)
|
|
<a name="l183"></a> c->flags|=</span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>;
|
|
<a name="l184"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l185"></a> c->flags&=~</span><span class=cF3>CTRLF_CLICKED</span><span class=cF0>;
|
|
<a name="l186"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l187"></a> (*c->update_derived_vals)(c);
|
|
<a name="l188"></a>}
|
|
<a name="l189"></a>
|
|
<a name="l190"></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="l191"></a>{
|
|
<a name="l192"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *s=c->state;
|
|
<a name="l193"></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="l194"></a> s->pos+=delta;
|
|
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l196"></a> (*c->update_derived_vals)(c);
|
|
<a name="l197"></a>}
|
|
<a name="l198"></a>
|
|
<a name="l199"></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="l200"></a>{
|
|
<a name="l201"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l202"></a>
|
|
<a name="l203"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l204"></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="l205"></a> c->win_task=task;
|
|
<a name="l206"></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="l207"></a> c->type=</span><span class=cF3>CTRLT_WIN_HSCROLL</span><span class=cF0>;
|
|
<a name="l208"></a> c->state=&task->horz_scroll;
|
|
<a name="l209"></a> c->update_derived_vals=&</span><span class=cF5>WinDerivedScrollValsUpdate</span><span class=cF0>;
|
|
<a name="l210"></a> c->draw_it=&</span><span class=cF5>DrawWinScroll</span><span class=cF0>;
|
|
<a name="l211"></a> c->left_click=&</span><span class=cF5>LeftClickHWinScroll</span><span class=cF0>;
|
|
<a name="l212"></a> </span><span class=cF5>QueIns</span><span class=cF0>(c,task->last_ctrl);
|
|
<a name="l213"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l214"></a>
|
|
<a name="l215"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l216"></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="l217"></a> c->win_task=task;
|
|
<a name="l218"></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="l219"></a> c->type=</span><span class=cF3>CTRLT_WIN_VSCROLL</span><span class=cF0>;
|
|
<a name="l220"></a> c->state=&task->vert_scroll;
|
|
<a name="l221"></a> c->update_derived_vals=&</span><span class=cF5>WinDerivedScrollValsUpdate</span><span class=cF0>;
|
|
<a name="l222"></a> c->draw_it=&</span><span class=cF5>DrawWinScroll</span><span class=cF0>;
|
|
<a name="l223"></a> c->left_click=&</span><span class=cF5>LeftClickVWinScroll</span><span class=cF0>;
|
|
<a name="l224"></a> c->wheel_chg=&</span><span class=cF5>WheelChangeWinScroll</span><span class=cF0>;
|
|
<a name="l225"></a> </span><span class=cF5>QueIns</span><span class=cF0>(c,task->last_ctrl);
|
|
<a name="l226"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l227"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task);
|
|
<a name="l228"></a>}
|
|
<a name="l229"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0> 22
|
|
<a name="l230"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0> 48
|
|
<a name="l231"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VIEWANGLES_BORDER</span><span class=cF0> 2
|
|
<a name="l232"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>VIEWANGLES_SNAP</span><span class=cF0> 2
|
|
<a name="l233"></a>
|
|
<a name="l234"></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="l235"></a>{
|
|
<a name="l236"></a> </span><span class=cF9>I64</span><span class=cF0> i,j;
|
|
<a name="l237"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s=c->state;
|
|
<a name="l238"></a>
|
|
<a name="l239"></a> dc->color=s->cbd;
|
|
<a name="l240"></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>*4+3,
|
|
<a name="l241"></a> </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>*2+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l242"></a> dc->color=s->cbg;
|
|
<a name="l243"></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="l244"></a> </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>*4+3-2*</span><span class=cF3>VIEWANGLES_BORDER</span><span class=cF0>,
|
|
<a name="l245"></a> </span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>*2+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-2*</span><span class=cF3>VIEWANGLES_BORDER</span><span class=cF0>);
|
|
<a name="l246"></a> dc->color=s->cfg;
|
|
<a name="l247"></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="l248"></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>+
|
|
<a name="l249"></a> </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-1);
|
|
<a name="l250"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,c->left+2*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+1,c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>,
|
|
<a name="l251"></a> c->left+2*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+1,c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+
|
|
<a name="l252"></a> </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-1);
|
|
<a name="l253"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,c->left+3*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+2,c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>,
|
|
<a name="l254"></a> c->left+3*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+2,c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+
|
|
<a name="l255"></a> </span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-1);
|
|
<a name="l256"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i<</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>+1;i+=2*</span><span class=cF3>VIEWANGLES_SNAP</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l257"></a> j=2-i/3&1;
|
|
<a name="l258"></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="l259"></a> c->left+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+j,c->bottom
|
|
<a name="l260"></a> -</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>-i);
|
|
<a name="l261"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,c->left+2*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+1-j,c->bottom-</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>-i,
|
|
<a name="l262"></a> c->left+2*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+1+j,c->bottom
|
|
<a name="l263"></a> -</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>-i);
|
|
<a name="l264"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,c->left+3*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+2-j,c->bottom-</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>-i,
|
|
<a name="l265"></a> c->left+3*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+2+j,c->bottom
|
|
<a name="l266"></a> -</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>-i);
|
|
<a name="l267"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l268"></a>
|
|
<a name="l269"></a> dc->color=s->cx;
|
|
<a name="l270"></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>/2,
|
|
<a name="l271"></a> c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>-</span><span class=cF7>(</span><span class=cF0>1+</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="l272"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,c->left+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>-3*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>/2,
|
|
<a name="l273"></a> c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>+3,
|
|
<a name="l274"></a> </span><span class=cF6>"%3d"</span><span class=cF0>,s->sx*360/</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l275"></a> i=c->left+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>;
|
|
<a name="l276"></a> </span><span class=cF1>if</span><span class=cF0> (s->sx></span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2)
|
|
<a name="l277"></a> j=-</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2+s->sx;
|
|
<a name="l278"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l279"></a> j=s->sx+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2;
|
|
<a name="l280"></a> j=c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-1-j;
|
|
<a name="l281"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,i-3,j-2,7,5);
|
|
<a name="l282"></a> dc->color=s->cx^8;
|
|
<a name="l283"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,i-2,j-1,5,3);
|
|
<a name="l284"></a>
|
|
<a name="l285"></a> dc->color=s->cy;
|
|
<a name="l286"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,c->left+2*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+1-</span><span class=cF3>FONT_WIDTH</span><span class=cF0>/2,
|
|
<a name="l287"></a> c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>-</span><span class=cF7>(</span><span class=cF0>1+</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="l288"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,c->left+2*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+1-3*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>/2,
|
|
<a name="l289"></a> c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>+3,
|
|
<a name="l290"></a> </span><span class=cF6>"%3d"</span><span class=cF0>,s->sy*360/</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l291"></a> i=c->left+2*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+1;
|
|
<a name="l292"></a> </span><span class=cF1>if</span><span class=cF0> (s->sy></span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2)
|
|
<a name="l293"></a> j=-</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2+s->sy;
|
|
<a name="l294"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l295"></a> j=s->sy+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2;
|
|
<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>-1-j;
|
|
<a name="l297"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,i-3,j-2,7,5);
|
|
<a name="l298"></a> dc->color=s->cy^8;
|
|
<a name="l299"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,i-2,j-1,5,3);
|
|
<a name="l300"></a>
|
|
<a name="l301"></a> dc->color=s->cz;
|
|
<a name="l302"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,c->left+3*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+2-</span><span class=cF3>FONT_WIDTH</span><span class=cF0>/2,
|
|
<a name="l303"></a> c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>-</span><span class=cF7>(</span><span class=cF0>1+</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="l304"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,c->left+3*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+2-3*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>/2,
|
|
<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>+3,
|
|
<a name="l306"></a> </span><span class=cF6>"%3d"</span><span class=cF0>,s->sz*360/</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l307"></a> i=c->left+3*</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+2;
|
|
<a name="l308"></a> </span><span class=cF1>if</span><span class=cF0> (s->sz></span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2)
|
|
<a name="l309"></a> j=-</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2+s->sz;
|
|
<a name="l310"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l311"></a> j=s->sz+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2;
|
|
<a name="l312"></a> j=c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-1-j;
|
|
<a name="l313"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,i-3,j-2,7,5);
|
|
<a name="l314"></a> dc->color=s->cz^8;
|
|
<a name="l315"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,i-2,j-1,5,3);
|
|
<a name="l316"></a>}
|
|
<a name="l317"></a>
|
|
<a name="l318"></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="l319"></a>{
|
|
<a name="l320"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s=c->state;
|
|
<a name="l321"></a> c->left=c->win_task->pix_width-(</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>*4+3);
|
|
<a name="l322"></a> c->right=c->left+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>*4+3;
|
|
<a name="l323"></a> c->top=c->win_task->pix_height-(</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>*2+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>);
|
|
<a name="l324"></a> c->bottom=c->top+</span><span class=cF3>VIEWANGLES_SPACING</span><span class=cF0>*2+</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>;
|
|
<a name="l325"></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>,0,</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-1);
|
|
<a name="l326"></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>,0,</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-1);
|
|
<a name="l327"></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>,0,</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-1);
|
|
<a name="l328"></a> s->ax=2*</span><span class=cF3>pi</span><span class=cF0>*s->sx/</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>;
|
|
<a name="l329"></a> s->ay=2*</span><span class=cF3>pi</span><span class=cF0>*s->sy/</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>;
|
|
<a name="l330"></a> s->az=2*</span><span class=cF3>pi</span><span class=cF0>*s->sz/</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>;
|
|
<a name="l331"></a>}
|
|
<a name="l332"></a>
|
|
<a name="l333"></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="l334"></a>{
|
|
<a name="l335"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s=c->state;
|
|
<a name="l336"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l337"></a> i=</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>-1-(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="l338"></a> </span><span class=cF1>if</span><span class=cF0> (i>=</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2)
|
|
<a name="l339"></a> i-=</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2;
|
|
<a name="l340"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l341"></a> i+=</span><span class=cF3>VIEWANGLES_RANGE</span><span class=cF0>/2;
|
|
<a name="l342"></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>/3)
|
|
<a name="l343"></a> s->sx=i;
|
|
<a name="l344"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (x<c->left+2*</span><span class=cF7>(</span><span class=cF0>c->right-c->left</span><span class=cF7>)</span><span class=cF0>/3)
|
|
<a name="l345"></a> s->sy=i;
|
|
<a name="l346"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l347"></a> s->sz=i;
|
|
<a name="l348"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l349"></a> (*c->update_derived_vals)(c);
|
|
<a name="l350"></a>}
|
|
<a name="l351"></a>
|
|
<a name="l352"></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="l353"></a>{</span><span class=cF2>//Create view angle ctrl. See </span><a href="/Wb/Demo/Graphics/Shading.HC.HTML#l1"><span class=cF4>::/Demo/Graphics/Shading.HC</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l354"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l355"></a> </span><span class=cF9>CViewAngles</span><span class=cF0> *s;
|
|
<a name="l356"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
|
|
<a name="l357"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l358"></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="l359"></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="l360"></a> s->cbd=</span><span class=cF3>BLUE</span><span class=cF0>;
|
|
<a name="l361"></a> s->cbg=</span><span class=cF3>LTBLUE</span><span class=cF0>;
|
|
<a name="l362"></a> s->cfg=</span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l363"></a> s->cx=</span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l364"></a> s->cy=</span><span class=cF3>GREEN</span><span class=cF0>;
|
|
<a name="l365"></a> s->cz=</span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l366"></a> c->win_task=task;
|
|
<a name="l367"></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="l368"></a> c->type=</span><span class=cF3>CTRLT_VIEWING_ANGLES</span><span class=cF0>;
|
|
<a name="l369"></a> c->state=s;
|
|
<a name="l370"></a> c->draw_it=&</span><span class=cF5>DrawViewAnglesCtrl</span><span class=cF0>;
|
|
<a name="l371"></a> c->left_click=&</span><span class=cF5>LeftClickViewAngles</span><span class=cF0>;
|
|
<a name="l372"></a> c->update_derived_vals=&</span><span class=cF5>UpdateDerivedViewAnglesCtrl</span><span class=cF0>;
|
|
<a name="l373"></a> </span><span class=cF5>QueIns</span><span class=cF0>(c,task->last_ctrl);
|
|
<a name="l374"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task);
|
|
<a name="l375"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l376"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l377"></a>}
|
|
<a name="l378"></a>
|
|
<a name="l379"></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="l380"></a>{</span><span class=cF2>//Free view angle ctrl.</span><span class=cF0>
|
|
<a name="l381"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c;
|
|
<a name="l382"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
|
|
<a name="l383"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l384"></a> </span><span class=cF5>QueRem</span><span class=cF0>(c);
|
|
<a name="l385"></a> </span><span class=cF5>Free</span><span class=cF0>(c->state);
|
|
<a name="l386"></a> </span><span class=cF5>Free</span><span class=cF0>(c);
|
|
<a name="l387"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l388"></a>}
|
|
</span></pre></body>
|
|
</html>
|