mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 16:26:35 +00:00
509 lines
50 KiB
HTML
Executable file
509 lines
50 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V1.08">
|
|
<style type="text/css">
|
|
body {background-color:#1f1f1f;}
|
|
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
|
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
|
.cF2{color:#73a255;background-color:#1f1f1f;}
|
|
.cF3{color:#297582;background-color:#1f1f1f;}
|
|
.cF4{color:#b34f4b;background-color:#1f1f1f;}
|
|
.cF5{color:#8a52c3;background-color:#1f1f1f;}
|
|
.cF6{color:#b7822f;background-color:#1f1f1f;}
|
|
.cF7{color:#444444;background-color:#1f1f1f;}
|
|
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
|
|
.cF9{color:#94bfde;background-color:#1f1f1f;}
|
|
.cFA{color:#a1ce97;background-color:#1f1f1f;}
|
|
.cFB{color:#6db4be;background-color:#1f1f1f;}
|
|
.cFC{color:#e88e88;background-color:#1f1f1f;}
|
|
.cFD{color:#ca94e8;background-color:#1f1f1f;}
|
|
.cFE{color:#d4b475;background-color:#1f1f1f;}
|
|
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>ifndef</span><span class=cF0> PALETTES_PATH
|
|
<a name="l2"></a></span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF3>__DIR__</span><span class=cF0>);;
|
|
<a name="l3"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Load"</span><span class=cF0>
|
|
<a name="l4"></a>#</span><span class=cF1>endif</span><span class=cF0>
|
|
<a name="l5"></a>
|
|
<a name="l6"></a></span><span class=cF2>// FIXME: bug where holding CTRL for 5-ish seconds crashes program!</span><span class=cF0>
|
|
<a name="l7"></a></span><span class=cF2>// TODO: move to Demo/Graphics, make sprite link in Menu</span><span class=cF0>
|
|
<a name="l8"></a>
|
|
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> SLIDER_RANGE </span><span class=cFE>255</span><span class=cF0>
|
|
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> SLIDER_SPACING </span><span class=cFE>28</span><span class=cF0>
|
|
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> SLIDER_BORDER </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l12"></a>
|
|
<a name="l13"></a></span><span class=cF9>I64</span><span class=cF0> current_palette = </span><span class=cF6>"*New Palette"</span><span class=cF0>;
|
|
<a name="l14"></a></span><span class=cF9>I64</span><span class=cF0> selected_color = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l15"></a></span><span class=cF9>I64</span><span class=cF0> l, r, t, b;
|
|
<a name="l16"></a>
|
|
<a name="l17"></a></span><span class=cF1>U8</span><span class=cF0> *manual_value;
|
|
<a name="l18"></a>
|
|
<a name="l19"></a></span><span class=cF9>CBGR24</span><span class=cF0> gr_temp_palette[</span><span class=cF3>COLORS_NUM</span><span class=cF0>];
|
|
<a name="l20"></a>
|
|
<a name="l21"></a></span><span class=cF1>class</span><span class=cF0> CSliderState
|
|
<a name="l22"></a>{
|
|
<a name="l23"></a> </span><span class=cF9>I64</span><span class=cF0> left_pos;
|
|
<a name="l24"></a> </span><span class=cF9>I64</span><span class=cF0> middle_pos;
|
|
<a name="l25"></a> </span><span class=cF9>I64</span><span class=cF0> right_pos;
|
|
<a name="l26"></a> </span><span class=cF9>I64</span><span class=cF0> preview;
|
|
<a name="l27"></a> </span><span class=cF9>CBGR24</span><span class=cF0> color;
|
|
<a name="l28"></a>
|
|
<a name="l29"></a>} sld;
|
|
<a name="l30"></a>
|
|
<a name="l31"></a></span><span class=cF1>I0</span><span class=cF0> DrawPixel(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>CBGR24</span><span class=cF0> color)
|
|
<a name="l32"></a>{
|
|
<a name="l33"></a> </span><span class=cFB>text</span><span class=cF0>.fb_alias[x + y * </span><span class=cF3>GR_WIDTH</span><span class=cF0>] = color;
|
|
<a name="l34"></a>}
|
|
<a name="l35"></a>
|
|
<a name="l36"></a></span><span class=cF1>U0</span><span class=cF0> DrawCtrlSlider(</span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l37"></a>{
|
|
<a name="l38"></a>
|
|
<a name="l39"></a> CSliderState *s = c->state;
|
|
<a name="l40"></a> </span><span class=cF9>I64</span><span class=cF0> size = (c->win_task->pix_width / </span><span class=cFE>16</span><span class=cF0>),
|
|
<a name="l41"></a> border = size / </span><span class=cFE>16</span><span class=cF0>,
|
|
<a name="l42"></a> size2 = (c->win_task->pix_height / </span><span class=cFE>32</span><span class=cF0>),
|
|
<a name="l43"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>slider_amount = 3,</span><span class=cF0>
|
|
<a name="l44"></a> i, k, j,</span><span class=cF2>// l,</span><span class=cF0>
|
|
<a name="l45"></a> pos, col,
|
|
<a name="l46"></a> bias;
|
|
<a name="l47"></a> </span><span class=cF9>CBGR24</span><span class=cF0> tempColor;
|
|
<a name="l48"></a>
|
|
<a name="l49"></a> </span><span class=cF2>///////////////////////</span><span class=cF0>
|
|
<a name="l50"></a> </span><span class=cF2>// CURRENT SELECTION //</span><span class=cF0>
|
|
<a name="l51"></a> </span><span class=cF2>///////////////////////</span><span class=cF0>
|
|
<a name="l52"></a>
|
|
<a name="l53"></a> </span><span class=cF2>// current color box preview</span><span class=cF0>
|
|
<a name="l54"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l55"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>10</span><span class=cF0>, </span><span class=cFE>10</span><span class=cF0>, </span><span class=cF6>"Preview:"</span><span class=cF0>);
|
|
<a name="l56"></a>
|
|
<a name="l57"></a> </span><span class=cF2>// pixel loop for current color preview</span><span class=cF0>
|
|
<a name="l58"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i <= </span><span class=cFE>12</span><span class=cF0>; i++)
|
|
<a name="l59"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j <= </span><span class=cFE>12</span><span class=cF0>; j++)
|
|
<a name="l60"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l61"></a> tempColor = </span><span class=cFB>gr_palette</span><span class=cF0>[selected_color];
|
|
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (i < border || i > </span><span class=cFE>12</span><span class=cF0> - border || j < border || j > </span><span class=cFE>12</span><span class=cF0> - border)
|
|
<a name="l63"></a> tempColor = </span><span class=cFE>0x000000</span><span class=cF0>;
|
|
<a name="l64"></a> DrawPixel(c->win_task->pix_left + </span><span class=cFE>78</span><span class=cF0> + i, t + </span><span class=cFE>7</span><span class=cF0> + j, tempColor);
|
|
<a name="l65"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l66"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>10</span><span class=cF0>, </span><span class=cFE>26</span><span class=cF0>, </span><span class=cF6>"Current Color: #%d"</span><span class=cF0>, selected_color + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (selected_color == </span><span class=cFE>15</span><span class=cF0>)
|
|
<a name="l68"></a> dc->color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l69"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>gr_palette</span><span class=cF0>[selected_color] > </span><span class=cFE>0xCCCCCC</span><span class=cF0>)
|
|
<a name="l70"></a> dc->color = </span><span class=cF3>DKGRAY</span><span class=cF0>;
|
|
<a name="l71"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l72"></a> dc->color = </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l73"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, </span><span class=cFE>94</span><span class=cF0>, </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>58</span><span class=cF0>, </span><span class=cFE>12</span><span class=cF0>);
|
|
<a name="l74"></a>
|
|
<a name="l75"></a> dc->color = selected_color;
|
|
<a name="l76"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>95</span><span class=cF0>, </span><span class=cFE>10</span><span class=cF0>, </span><span class=cF6>"#%x%x%x"</span><span class=cF0>, </span><span class=cFB>gr_palette</span><span class=cF0>[selected_color].r,
|
|
<a name="l77"></a> </span><span class=cFB>gr_palette</span><span class=cF0>[selected_color].g,
|
|
<a name="l78"></a> </span><span class=cFB>gr_palette</span><span class=cF0>[selected_color].b);
|
|
<a name="l79"></a>
|
|
<a name="l80"></a> </span><span class=cF2>// palette name</span><span class=cF0>
|
|
<a name="l81"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l82"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>10</span><span class=cF0>, </span><span class=cFE>43</span><span class=cF0>, </span><span class=cF6>"Palette: %s"</span><span class=cF0>, current_palette);
|
|
<a name="l83"></a>
|
|
<a name="l84"></a> </span><span class=cF2>////////////</span><span class=cF0>
|
|
<a name="l85"></a> </span><span class=cF2>// SLIDER //</span><span class=cF0>
|
|
<a name="l86"></a> </span><span class=cF2>////////////</span><span class=cF0>
|
|
<a name="l87"></a>
|
|
<a name="l88"></a> </span><span class=cF2>//box</span><span class=cF0>
|
|
<a name="l89"></a> dc->color = </span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l90"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left,
|
|
<a name="l91"></a> c->top,
|
|
<a name="l92"></a> SLIDER_SPACING * </span><span class=cFE>4</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l93"></a> SLIDER_SPACING * </span><span class=cFE>2</span><span class=cF0> + SLIDER_RANGE);
|
|
<a name="l94"></a> dc->color = </span><span class=cF3>BLUE</span><span class=cF0>;
|
|
<a name="l95"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left + SLIDER_BORDER,
|
|
<a name="l96"></a> c->top + SLIDER_BORDER,
|
|
<a name="l97"></a> SLIDER_SPACING * </span><span class=cFE>4</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> * SLIDER_BORDER,
|
|
<a name="l98"></a> SLIDER_SPACING * </span><span class=cFE>2</span><span class=cF0> + SLIDER_RANGE - </span><span class=cFE>2</span><span class=cF0> * SLIDER_BORDER);
|
|
<a name="l99"></a>
|
|
<a name="l100"></a> </span><span class=cF2>//slider</span><span class=cF0>
|
|
<a name="l101"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l102"></a>
|
|
<a name="l103"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i <= </span><span class=cFE>3</span><span class=cF0>; i++)
|
|
<a name="l104"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l105"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, c->left + i * SLIDER_SPACING + i - </span><span class=cFE>1</span><span class=cF0>,
|
|
<a name="l106"></a> c->top + SLIDER_SPACING,
|
|
<a name="l107"></a> c->left + i * SLIDER_SPACING + i - </span><span class=cFE>1</span><span class=cF0>,
|
|
<a name="l108"></a> c->top + SLIDER_SPACING + SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l109"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l110"></a>
|
|
<a name="l111"></a> </span><span class=cF2>//values</span><span class=cF0>
|
|
<a name="l112"></a> dc->color = </span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l113"></a>
|
|
<a name="l114"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i <= </span><span class=cFE>3</span><span class=cF0>; i++)
|
|
<a name="l115"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l116"></a> </span><span class=cF1>switch</span><span class=cF0> (i)
|
|
<a name="l117"></a> {
|
|
<a name="l118"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
|
<a name="l119"></a> pos = s->left_pos;
|
|
<a name="l120"></a> col = </span><span class=cF6>"R"</span><span class=cF0>;
|
|
<a name="l121"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l122"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
|
<a name="l123"></a> pos = s->middle_pos;
|
|
<a name="l124"></a> col = </span><span class=cF6>"G"</span><span class=cF0>;
|
|
<a name="l125"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l126"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>3</span><span class=cF0>:
|
|
<a name="l127"></a> pos = s->right_pos;
|
|
<a name="l128"></a> col = </span><span class=cF6>"B"</span><span class=cF0>;
|
|
<a name="l129"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l130"></a> }
|
|
<a name="l131"></a>
|
|
<a name="l132"></a> </span><span class=cF2>//values</span><span class=cF0>
|
|
<a name="l133"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + i * SLIDER_SPACING + i - </span><span class=cF3>FONT_WIDTH</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l134"></a> c->top + SLIDER_SPACING + SLIDER_RANGE + </span><span class=cFE>8</span><span class=cF0>,
|
|
<a name="l135"></a> </span><span class=cF6>"%d"</span><span class=cF0>, pos);
|
|
<a name="l136"></a> </span><span class=cF2>//RGB label</span><span class=cF0>
|
|
<a name="l137"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, c->left + i * SLIDER_SPACING + </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="l138"></a> c->top + </span><span class=cFE>14</span><span class=cF0>,
|
|
<a name="l139"></a> </span><span class=cF6>"%s"</span><span class=cF0>, col);
|
|
<a name="l140"></a> </span><span class=cF2>//knobs</span><span class=cF0>
|
|
<a name="l141"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, c->left + i * SLIDER_SPACING + i - </span><span class=cFE>4</span><span class=cF0>,
|
|
<a name="l142"></a> c->top + SLIDER_SPACING + SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - pos - </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l143"></a> </span><span class=cFE>7</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0>);
|
|
<a name="l144"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l145"></a>
|
|
<a name="l146"></a> </span><span class=cF2>////////////////////</span><span class=cF0>
|
|
<a name="l147"></a> </span><span class=cF2>// COLORS PREVIEW //</span><span class=cF0>
|
|
<a name="l148"></a> </span><span class=cF2>////////////////////</span><span class=cF0>
|
|
<a name="l149"></a>
|
|
<a name="l150"></a> dc->color = </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l151"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, c->win_task->pix_height + size * </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> - size * </span><span class=cFE>2</span><span class=cF0>, c->win_task->pix_width, size * </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>75</span><span class=cF0>);
|
|
<a name="l152"></a>
|
|
<a name="l153"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cF3>COLORS_NUM</span><span class=cF0>; i++)
|
|
<a name="l154"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l155"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j <= size; j++)
|
|
<a name="l156"></a> {
|
|
<a name="l157"></a> </span><span class=cF1>for</span><span class=cF0> (k = </span><span class=cFE>0</span><span class=cF0>; k <= size; k++)
|
|
<a name="l158"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l159"></a> tempColor = </span><span class=cFB>gr_palette</span><span class=cF0>[i];
|
|
<a name="l160"></a> </span><span class=cF2>// black borders</span><span class=cF0>
|
|
<a name="l161"></a> </span><span class=cF1>if</span><span class=cF0> (k < border || k > size - border || j < border || j > size - border - </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l162"></a> {
|
|
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (selected_color == i)
|
|
<a name="l164"></a> tempColor = </span><span class=cFE>0xFFFFFF</span><span class=cF0>;
|
|
<a name="l165"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l166"></a> tempColor = </span><span class=cFE>0x000000</span><span class=cF0>;
|
|
<a name="l167"></a> }
|
|
<a name="l168"></a> </span><span class=cF2>// color preview</span><span class=cF0>
|
|
<a name="l169"></a> DrawPixel(c->win_task->pix_left + j + </span><span class=cF7>(</span><span class=cF0>size * i</span><span class=cF7>)</span><span class=cF0>, c->win_task->pix_bottom - size * </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> + k, tempColor);
|
|
<a name="l170"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l171"></a> }
|
|
<a name="l172"></a> </span><span class=cF2>// color label and text preview</span><span class=cF0>
|
|
<a name="l173"></a> </span><span class=cF2>// TODO: THIS LOGIC DOESNT WORK ON LIGHT THEMES</span><span class=cF0>
|
|
<a name="l174"></a> </span><span class=cF2>// if color too light or too dark add bg</span><span class=cF0>
|
|
<a name="l175"></a>
|
|
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (i == </span><span class=cFE>15</span><span class=cF0>)
|
|
<a name="l177"></a> dc->color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l178"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>gr_palette</span><span class=cF0>[i] < </span><span class=cFB>gr_palette</span><span class=cF0>[</span><span class=cFE>15</span><span class=cF0>])
|
|
<a name="l179"></a> dc->color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l180"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>gr_palette</span><span class=cF0>[i] > </span><span class=cFB>gr_palette</span><span class=cF0>[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l181"></a> dc->color = </span><span class=cF3>DKGRAY</span><span class=cF0>;
|
|
<a name="l182"></a> </span><span class=cF2>/*else if (i == 7)</span><span class=cF0>
|
|
<a name="l183"></a> </span><span class=cF2>dc->color = LTRED;*/</span><span class=cF0>
|
|
<a name="l184"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l185"></a> dc->color = </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l186"></a> </span><span class=cF1>if</span><span class=cF0> (i == selected_color)
|
|
<a name="l187"></a> dc->color = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l188"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, </span><span class=cFE>6</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>size2 * </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>65</span><span class=cF0> + </span><span class=cFE>16</span><span class=cF0> * i, </span><span class=cFE>80</span><span class=cF0>, </span><span class=cFE>18</span><span class=cF0>);
|
|
<a name="l189"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>size * i</span><span class=cF7>)</span><span class=cF0>, c->win_task->pix_height - </span><span class=cF7>(</span><span class=cF0>size - size / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, size, size * </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>);
|
|
<a name="l190"></a>
|
|
<a name="l191"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, </span><span class=cFE>6</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>size2 * </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>65</span><span class=cF0> + </span><span class=cFE>16</span><span class=cF0> * i, </span><span class=cFE>80</span><span class=cF0>, </span><span class=cFE>18</span><span class=cF0>);
|
|
<a name="l192"></a>
|
|
<a name="l193"></a>
|
|
<a name="l194"></a> </span><span class=cF1>if</span><span class=cF0> (i == selected_color)
|
|
<a name="l195"></a> dc->color = </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l196"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l197"></a> dc->color = i;
|
|
<a name="l198"></a> bias = (size / </span><span class=cFE>2</span><span class=cF0>) - </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (i >= </span><span class=cFE>9</span><span class=cF0>)
|
|
<a name="l200"></a> bias = (size / </span><span class=cFE>2</span><span class=cF0>) - </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l201"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, bias + </span><span class=cF7>(</span><span class=cF0>i * size</span><span class=cF7>)</span><span class=cF0>, c->win_task->pix_height - </span><span class=cF7>(</span><span class=cF0>size * .</span><span class=cFE>6</span><span class=cF7>)</span><span class=cF0> + </span><span class=cF7>(</span><span class=cF0>size / </span><span class=cFE>4</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF6>"%d"</span><span class=cF0>, i + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l202"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>10</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>size2 * </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>70</span><span class=cF0> + </span><span class=cFE>16</span><span class=cF0> * i, </span><span class=cF6>"#%d: Test"</span><span class=cF0>, i + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l203"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l204"></a>
|
|
<a name="l205"></a>
|
|
<a name="l206"></a> </span><span class=cF2>// Add Save/Load button?</span><span class=cF0>
|
|
<a name="l207"></a>
|
|
<a name="l208"></a>}
|
|
<a name="l209"></a>
|
|
<a name="l210"></a>
|
|
<a name="l211"></a>
|
|
<a name="l212"></a></span><span class=cF1>U0</span><span class=cF0> PESave(</span><span class=cF1>Bool</span><span class=cF0> prompt, </span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l213"></a>{
|
|
<a name="l214"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>(PALETTES_PATH);
|
|
<a name="l215"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l216"></a> </span><span class=cF1>no_warn</span><span class=cF0> c; </span><span class=cF2>// TODO remove param if not needed</span><span class=cF0>
|
|
<a name="l217"></a> </span><span class=cF1>U8</span><span class=cF0> *tmp1, *tmp2; </span><span class=cF2>// 1: lower, 2: Capital</span><span class=cF0>
|
|
<a name="l218"></a>
|
|
<a name="l219"></a> </span><span class=cF1>if</span><span class=cF0> (prompt)
|
|
<a name="l220"></a> </span><span class=cF5>DocForm</span><span class=cF0>(&doc->filename);
|
|
<a name="l221"></a>
|
|
<a name="l222"></a> tmp1 = </span><span class=cF5>StrNew</span><span class=cF0>(&doc->filename.name);
|
|
<a name="l223"></a> </span><span class=cF5>StrLastRemove</span><span class=cF0>(tmp1, </span><span class=cF6>"/"</span><span class=cF0>, tmp1);
|
|
<a name="l224"></a> </span><span class=cF5>StrReplace</span><span class=cF0>(tmp1, </span><span class=cF6>".ZC"</span><span class=cF0>, </span><span class=cF6>""</span><span class=cF0>);
|
|
<a name="l225"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>tmp1</span><span class=cF7>)</span><span class=cF0>; i++)
|
|
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'A'</span><span class=cF0> <= tmp1[i] <= </span><span class=cF6>'Z'</span><span class=cF0>)
|
|
<a name="l227"></a> tmp1[i] = tmp1[i] + </span><span class=cFE>32</span><span class=cF0>;
|
|
<a name="l228"></a>
|
|
<a name="l229"></a> tmp2 = </span><span class=cF5>StrNew</span><span class=cF0>(tmp1);
|
|
<a name="l230"></a> tmp2[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cF5>ToUpper</span><span class=cF0>(tmp2[</span><span class=cFE>0</span><span class=cF0>]);
|
|
<a name="l231"></a>
|
|
<a name="l232"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"public CBGR24 gr_palette_%s[COLORS_NUM] = {\n"</span><span class=cF0>, tmp1);
|
|
<a name="l233"></a>
|
|
<a name="l234"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cF3>COLORS_NUM</span><span class=cF0>; i++)
|
|
<a name="l235"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (i == </span><span class=cF3>COLORS_NUM</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l237"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"0x%X"</span><span class=cF0>, </span><span class=cFB>gr_palette</span><span class=cF0>[i]);
|
|
<a name="l238"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l239"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"0x%X, "</span><span class=cF0>, </span><span class=cFB>gr_palette</span><span class=cF0>[i]);
|
|
<a name="l240"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l241"></a>
|
|
<a name="l242"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"\n};\npublic U0 PaletteSet%s(Bool persistent=TRUE)\n{\n"</span><span class=cF0>
|
|
<a name="l243"></a> </span><span class=cF6>"\tGrPaletteSet(gr_palette_%s);\n"</span><span class=cF0>
|
|
<a name="l244"></a> </span><span class=cF6>"\tLFBFlush;\n"</span><span class=cF0>
|
|
<a name="l245"></a> </span><span class=cF6>"\tif (persistent)\n"</span><span class=cF0>
|
|
<a name="l246"></a> </span><span class=cF6>"\t\tfp_set_std_palette = &PaletteSet%s;\n}"</span><span class=cF0>, tmp2, tmp1, tmp2);
|
|
<a name="l247"></a>
|
|
<a name="l248"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc);
|
|
<a name="l249"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l250"></a>}
|
|
<a name="l251"></a>
|
|
<a name="l252"></a>
|
|
<a name="l253"></a></span><span class=cF1>U0</span><span class=cF0> PaletteSetTemp(</span><span class=cF1>Bool</span><span class=cF0> persistent=</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l254"></a>{</span><span class=cF2>//Activate temp palette.</span><span class=cF0>
|
|
<a name="l255"></a> </span><span class=cF5>GrPaletteSet</span><span class=cF0>(</span><span class=cFB>gr_palette</span><span class=cF0>);
|
|
<a name="l256"></a> </span><span class=cF5>LFBFlush</span><span class=cF0>;
|
|
<a name="l257"></a> </span><span class=cF1>if</span><span class=cF0> (persistent)
|
|
<a name="l258"></a> </span><span class=cFB>fp_set_std_palette</span><span class=cF0> = &PaletteSetTemp;
|
|
<a name="l259"></a>}
|
|
<a name="l260"></a>
|
|
<a name="l261"></a></span><span class=cF1>U0</span><span class=cF0> PalettePrint(){
|
|
<a name="l262"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l263"></a>
|
|
<a name="l264"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cF3>COLORS_NUM</span><span class=cF0>; i++)
|
|
<a name="l265"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l266"></a> </span><span class=cF6>"%d: #%X\n"</span><span class=cF0>, i, </span><span class=cFB>gr_palette</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>
|
|
<a name="l270"></a></span><span class=cF1>U0</span><span class=cF0> SelectColor(</span><span class=cF9>I64</span><span class=cF0> color_number, </span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l271"></a>{
|
|
<a name="l272"></a> selected_color = color_number;
|
|
<a name="l273"></a> CSliderState *s = c->state;
|
|
<a name="l274"></a>
|
|
<a name="l275"></a> s->left_pos = </span><span class=cFB>gr_palette</span><span class=cF0>[selected_color].r;
|
|
<a name="l276"></a> s->middle_pos= </span><span class=cFB>gr_palette</span><span class=cF0>[selected_color].g;
|
|
<a name="l277"></a> s->right_pos = </span><span class=cFB>gr_palette</span><span class=cF0>[selected_color].b;
|
|
<a name="l278"></a>}
|
|
<a name="l279"></a>
|
|
<a name="l280"></a></span><span class=cF1>U0</span><span class=cF0> UpdateDerivedCtrlSlider(</span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l281"></a>{
|
|
<a name="l282"></a> CSliderState *s = c->state;
|
|
<a name="l283"></a>
|
|
<a name="l284"></a>
|
|
<a name="l285"></a> c->left = (c->win_task->pix_width / </span><span class=cFE>2</span><span class=cF0>) - (SLIDER_SPACING * </span><span class=cFE>3</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>) / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l286"></a> c->right = c->left + </span><span class=cFE>3</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l287"></a> c->top = c->win_task->pix_height / </span><span class=cFE>2</span><span class=cF0> - (SLIDER_SPACING * </span><span class=cFE>2</span><span class=cF0> + SLIDER_RANGE) / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l288"></a> c->bottom = c->top + SLIDER_SPACING * </span><span class=cFE>2</span><span class=cF0> + SLIDER_RANGE;
|
|
<a name="l289"></a>
|
|
<a name="l290"></a> </span><span class=cF2>// I used to clamp between 0 and 127 and do math but i changed it to 256 for now.</span><span class=cF0>
|
|
<a name="l291"></a> s->left_pos = </span><span class=cF5>ClampI64</span><span class=cF0>(s->left_pos, </span><span class=cFE>0</span><span class=cF0>, SLIDER_RANGE);
|
|
<a name="l292"></a> s->middle_pos = </span><span class=cF5>ClampI64</span><span class=cF0>(s->middle_pos, </span><span class=cFE>0</span><span class=cF0>, SLIDER_RANGE);
|
|
<a name="l293"></a> s->right_pos = </span><span class=cF5>ClampI64</span><span class=cF0>(s->right_pos, </span><span class=cFE>0</span><span class=cF0>, SLIDER_RANGE);
|
|
<a name="l294"></a>
|
|
<a name="l295"></a> </span><span class=cF2>// add the slider's RGB value to s->preview </span><span class=cF0> </span><span class=cF2>// opposite for BGR</span><span class=cF0>
|
|
<a name="l296"></a> s->preview = s->right_pos + s->middle_pos << </span><span class=cFE>8</span><span class=cF0> + s->left_pos << </span><span class=cFE>16</span><span class=cF0>; </span><span class=cF2>//s->left_pos + s->middle_pos << 8 + s->right_pos << 16;</span><span class=cF0>
|
|
<a name="l297"></a>
|
|
<a name="l298"></a> </span><span class=cF2>// cheap way to force redraw 32bit colors</span><span class=cF0>
|
|
<a name="l299"></a> </span><span class=cF2>// TODO: make this not stupid</span><span class=cF0>
|
|
<a name="l300"></a> </span><span class=cF2>// can I use *last_task?</span><span class=cF0>
|
|
<a name="l301"></a> </span><span class=cF1>if</span><span class=cF0> (c->win_task->pix_left != l ||
|
|
<a name="l302"></a> c->win_task->pix_right != r ||
|
|
<a name="l303"></a> c->win_task->pix_bottom != b ||
|
|
<a name="l304"></a> c->win_task->pix_top != t)
|
|
<a name="l305"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l306"></a> l = c->win_task->pix_left;
|
|
<a name="l307"></a> r = c->win_task->pix_right;
|
|
<a name="l308"></a> t = c->win_task->pix_top;
|
|
<a name="l309"></a> b = c->win_task->pix_bottom;
|
|
<a name="l310"></a> </span><span class=cF5>LFBFlush</span><span class=cF0>;
|
|
<a name="l311"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l312"></a>}
|
|
<a name="l313"></a>
|
|
<a name="l314"></a>
|
|
<a name="l315"></a></span><span class=cF1>U0</span><span class=cF0> LeftClickSlider(</span><span class=cF9>CCtrl</span><span class=cF0> *c, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF1>Bool</span><span class=cF0>)
|
|
<a name="l316"></a>{
|
|
<a name="l317"></a> CSliderState *s = c->state;
|
|
<a name="l318"></a>
|
|
<a name="l319"></a> </span><span class=cF1>if</span><span class=cF0> (x < c->left + </span><span class=cFE>1</span><span class=cF0> * SLIDER_SPACING + </span><span class=cFE>0</span><span class=cF0> + SLIDER_SPACING / </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l320"></a> s->left_pos = SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - (y - </span><span class=cF7>(</span><span class=cF0>c->top + SLIDER_SPACING</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l321"></a>
|
|
<a name="l322"></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> * SLIDER_SPACING + </span><span class=cFE>1</span><span class=cF0> + SLIDER_SPACING / </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l323"></a> s->middle_pos = SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - (y - </span><span class=cF7>(</span><span class=cF0>c->top + SLIDER_SPACING</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l324"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l325"></a> s->right_pos = SLIDER_RANGE - </span><span class=cFE>1</span><span class=cF0> - (y - </span><span class=cF7>(</span><span class=cF0>c->top + SLIDER_SPACING</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l326"></a>
|
|
<a name="l327"></a> </span><span class=cF1>if</span><span class=cF0> (c->update_derived_vals)
|
|
<a name="l328"></a> (*c->update_derived_vals)(c);
|
|
<a name="l329"></a>
|
|
<a name="l330"></a> </span><span class=cF2>// set palette</span><span class=cF0>
|
|
<a name="l331"></a> </span><span class=cFB>gr_palette</span><span class=cF0>[selected_color] = s->preview;
|
|
<a name="l332"></a> PaletteSetTemp(</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l333"></a>
|
|
<a name="l334"></a> current_palette = </span><span class=cF6>"*New Palette"</span><span class=cF0>;
|
|
<a name="l335"></a>}
|
|
<a name="l336"></a>
|
|
<a name="l337"></a></span><span class=cF9>CCtrl</span><span class=cF0> *SliderNew()
|
|
<a name="l338"></a>{
|
|
<a name="l339"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CCtrl</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l340"></a> c->win_task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
<a name="l341"></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="l342"></a> c->type = </span><span class=cF3>CTRLT_GENERIC</span><span class=cF0>;
|
|
<a name="l343"></a> c->state = &sld;
|
|
<a name="l344"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&sld,</span><span class=cFE>0</span><span class=cF0>,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CSliderState</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l345"></a> c->draw_it = &DrawCtrlSlider;
|
|
<a name="l346"></a> c->left_click = &LeftClickSlider;
|
|
<a name="l347"></a> c->update_derived_vals = &UpdateDerivedCtrlSlider;
|
|
<a name="l348"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(c, </span><span class=cF5>Fs</span><span class=cF0>->last_ctrl);
|
|
<a name="l349"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>;
|
|
<a name="l350"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l351"></a>}
|
|
<a name="l352"></a>
|
|
<a name="l353"></a></span><span class=cF1>U0</span><span class=cF0> SliderDel(</span><span class=cF9>CCtrl</span><span class=cF0> *c)
|
|
<a name="l354"></a>{
|
|
<a name="l355"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(c);
|
|
<a name="l356"></a> </span><span class=cF5>Free</span><span class=cF0>(c);
|
|
<a name="l357"></a>}
|
|
<a name="l358"></a>
|
|
<a name="l359"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> PaletteEditor()
|
|
<a name="l360"></a>{
|
|
<a name="l361"></a>
|
|
<a name="l362"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>;
|
|
<a name="l363"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
|
|
<a name="l364"></a> </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l365"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>Open(,CH_CTRLO);"</span><span class=cF0>
|
|
<a name="l366"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>SaveAs(,CH_CTRLA);"</span><span class=cF0>
|
|
<a name="l367"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l368"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l369"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l370"></a> </span><span class=cF6>"Edit {"</span><span class=cF0>
|
|
<a name="l371"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>Hex(,'#');"</span><span class=cF0>
|
|
<a name="l372"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>PreviousColor(,,SC_CURSOR_LEFT);"</span><span class=cF0>
|
|
<a name="l373"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>PreviousColor(,,SC_CURSOR_UP);"</span><span class=cF0>
|
|
<a name="l374"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>NextColor(,,SC_CURSOR_RIGHT);"</span><span class=cF0>
|
|
<a name="l375"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>NextColor(,,SC_CURSOR_DOWN);"</span><span class=cF0>
|
|
<a name="l376"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l377"></a> </span><span class=cF6>"About {"</span><span class=cF0>
|
|
<a name="l378"></a> </span><span class=cF6>"</span><span class=cF0> </span><span class=cF6>Info(,CH_CTRLI);"</span><span class=cF0>
|
|
<a name="l379"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l380"></a> );
|
|
<a name="l381"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l382"></a> </span><span class=cF5>WinBorder</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>);
|
|
<a name="l383"></a>
|
|
<a name="l384"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *c = SliderNew;
|
|
<a name="l385"></a> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF2>/*arg1, arg2,*/</span><span class=cF0> sc = </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l386"></a> original_left, original_right, original_top, original_bottom;
|
|
<a name="l387"></a> </span><span class=cF1>Bool</span><span class=cF0> is_done = </span><span class=cF3>FALSE</span><span class=cF0>, keep_palette = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l388"></a>
|
|
<a name="l389"></a> original_left = c->win_task->win_left;
|
|
<a name="l390"></a> original_right = c->win_task->win_right;
|
|
<a name="l391"></a> original_top = c->win_task->win_top;
|
|
<a name="l392"></a> original_bottom = c->win_task->win_bottom;
|
|
<a name="l393"></a>
|
|
<a name="l394"></a> </span><span class=cF2>// windowed</span><span class=cF0>
|
|
<a name="l395"></a> c->win_task->win_left = (</span><span class=cF3>GR_WIDTH</span><span class=cF0> / </span><span class=cFE>23</span><span class=cF0>);
|
|
<a name="l396"></a> c->win_task->win_right = (</span><span class=cF3>GR_WIDTH</span><span class=cF0> / </span><span class=cFE>13</span><span class=cF0>);
|
|
<a name="l397"></a> c->win_task->win_top = </span><span class=cF3>GR_HEIGHT</span><span class=cF0> / </span><span class=cFE>80</span><span class=cF0>;
|
|
<a name="l398"></a> c->win_task->win_bottom = </span><span class=cF3>GR_HEIGHT</span><span class=cF0> / </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l399"></a>
|
|
<a name="l400"></a>
|
|
<a name="l401"></a> </span><span class=cF2>// init pos for 32bit redraw</span><span class=cF0>
|
|
<a name="l402"></a> l = c->win_task->pix_left;
|
|
<a name="l403"></a> r = c->win_task->pix_right;
|
|
<a name="l404"></a> t = c->win_task->pix_top;
|
|
<a name="l405"></a> b = c->win_task->pix_bottom;
|
|
<a name="l406"></a>
|
|
<a name="l407"></a>
|
|
<a name="l408"></a> SelectColor(</span><span class=cFE>0</span><span class=cF0>, c);
|
|
<a name="l409"></a>
|
|
<a name="l410"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l411"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l412"></a> </span><span class=cF1>while</span><span class=cF0> (!is_done)
|
|
<a name="l413"></a> {
|
|
<a name="l414"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>KeyGet</span><span class=cF7>(</span><span class=cF0>&sc</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l415"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l416"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'#'</span><span class=cF0>:
|
|
<a name="l417"></a> manual_value = </span><span class=cF5>StrGet</span><span class=cF0>(</span><span class=cF6>" Hex Value: #"</span><span class=cF0>);
|
|
<a name="l418"></a> </span><span class=cFB>gr_palette</span><span class=cF0>[selected_color] = </span><span class=cF5>Str2I64</span><span class=cF0>(manual_value, </span><span class=cFE>16</span><span class=cF0>);
|
|
<a name="l419"></a> </span><span class=cF5>Free</span><span class=cF0>(manual_value);
|
|
<a name="l420"></a> SelectColor(selected_color, c);
|
|
<a name="l421"></a> </span><span class=cF5>LFBFlush</span><span class=cF0>;
|
|
<a name="l422"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l423"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l424"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
|
<a name="l425"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l426"></a> {
|
|
<a name="l427"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
|
|
<a name="l428"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
|
<a name="l429"></a> </span><span class=cF1>if</span><span class=cF0> (selected_color == </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l430"></a> selected_color = </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l431"></a> SelectColor(selected_color - </span><span class=cFE>1</span><span class=cF0>, c);
|
|
<a name="l432"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l433"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
|
|
<a name="l434"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
|
<a name="l435"></a> </span><span class=cF1>if</span><span class=cF0> (selected_color == </span><span class=cFE>15</span><span class=cF0>)
|
|
<a name="l436"></a> selected_color = -</span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l437"></a> SelectColor(selected_color + </span><span class=cFE>1</span><span class=cF0>, c);
|
|
<a name="l438"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l439"></a> }
|
|
<a name="l440"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l441"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLO</span><span class=cF0>:
|
|
<a name="l442"></a> current_palette = </span><span class=cF6>""</span><span class=cF0>;
|
|
<a name="l443"></a> current_palette = PaletteSelect;
|
|
<a name="l444"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l445"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLI</span><span class=cF0>:
|
|
<a name="l446"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(</span><span class=cF6>"\n\n Use the arrows to select color\n\n # to manually input hex value"</span><span class=cF0>,</span><span class=cF6>"\n\n\n\t\tMade by y4my4m\n\n"</span><span class=cF0>);
|
|
<a name="l447"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l448"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLA</span><span class=cF0>:
|
|
<a name="l449"></a> PESave(</span><span class=cF3>TRUE</span><span class=cF0>, c);
|
|
<a name="l450"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l451"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l452"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&gr_temp_palette, </span><span class=cFB>gr_palette</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CBGR24</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF3>COLORS_NUM</span><span class=cF0>);
|
|
<a name="l453"></a> keep_palette = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l454"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l455"></a> </span><span class=cF5>LFBFlush</span><span class=cF0>;
|
|
<a name="l456"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l457"></a> is_done = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l458"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l459"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
|
|
<a name="l460"></a> }
|
|
<a name="l461"></a>
|
|
<a name="l462"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l463"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l464"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l465"></a>
|
|
<a name="l466"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l467"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l468"></a>
|
|
<a name="l469"></a> </span><span class=cF1>if</span><span class=cF0> (keep_palette)
|
|
<a name="l470"></a> </span><span class=cF5>GrPaletteSet</span><span class=cF0>(gr_temp_palette);
|
|
<a name="l471"></a>
|
|
<a name="l472"></a> SliderDel(c);
|
|
<a name="l473"></a> </span><span class=cF5>DocBottom</span><span class=cF0>;
|
|
<a name="l474"></a>
|
|
<a name="l475"></a>
|
|
<a name="l476"></a> c->win_task->win_left = original_left;
|
|
<a name="l477"></a> c->win_task->win_right = original_right;
|
|
<a name="l478"></a> c->win_task->win_top = original_top;
|
|
<a name="l479"></a> c->win_task->win_bottom = original_bottom;
|
|
<a name="l480"></a>}
|
|
</span></pre></body>
|
|
</html>
|