Rev 7219 | Rev 7227 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7219 | Rev 7225 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | 15 | ||
16 | #ifndef INCLUDE_MATH_H |
16 | #ifndef INCLUDE_MATH_H |
17 | #include "../lib/math.h" |
17 | #include "../lib/math.h" |
Line -... | Line 18... | ||
- | 18 | #endif |
|
- | 19 | ||
- | 20 | #include "../lib/gui/tabs.h" |
|
18 | #endif |
21 | #include "../lib/gui/more_less_box.h" |
19 | 22 | ||
20 | :void DrawRectangle(dword x,y,w,h,color1) |
23 | :void DrawRectangle(dword x,y,w,h,color1) |
21 | { |
24 | { |
22 | if (w<=0) || (h<=0) return; |
25 | if (w<=0) || (h<=0) return; |
Line 161... | Line 164... | ||
161 | DrawBar(x+3, y+3, w-5, h-5, 0x888888); |
164 | DrawBar(x+3, y+3, w-5, h-5, 0x888888); |
162 | } |
165 | } |
163 | DrawRectangle3D(x-1,y-1,w+2,h+2,system.color.work_dark,system.color.work_light); |
166 | DrawRectangle3D(x-1,y-1,w+2,h+2,system.color.work_dark,system.color.work_light); |
164 | } |
167 | } |
Line 165... | Line -... | ||
165 | - | ||
166 | :void MoreLessBox(dword x,y, bt_id_more, bt_id_less, value, text) |
- | |
167 | { |
- | |
168 | #define VALUE_FIELD_W 34 |
- | |
169 | #define SIZE 18 |
- | |
170 | dword value_text = itoa(value); |
- | |
171 | - | ||
172 | DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph); |
- | |
173 | DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff); |
- | |
174 | DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff); |
- | |
175 | WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text); |
- | |
176 | - | ||
177 | DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+"); |
- | |
178 | DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-"); |
- | |
179 | EDI = system.color.work; |
- | |
180 | WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text); |
- | |
181 | DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); |
- | |
182 | } |
- | |
183 | 168 | ||
184 | :void DrawEditBox(dword edit_box_pointer) |
169 | :void DrawEditBox(dword edit_box_pointer) |
185 | { |
170 | { |
186 | dword x,y,w,h,bg; |
171 | dword x,y,w,h,bg; |
187 | ESI = edit_box_pointer; |
172 | ESI = edit_box_pointer; |
Line 360... | Line 345... | ||
360 | n+=_addition; |
345 | n+=_addition; |
361 | return n; |
346 | return n; |
362 | } |
347 | } |
Line 363... | Line -... | ||
363 | - | ||
364 | - | ||
365 | /*========================================================= |
- | |
366 | == |
- | |
367 | == TABS |
- | |
368 | == |
- | |
369 | /========================================================*/ |
- | |
370 | - | ||
371 | #define TAB_PADDING 25 |
- | |
372 | #define TAB_HEIGHT 25 |
- | |
373 | - | ||
374 | :struct _tabs |
- | |
375 | { |
- | |
376 | int active_tab; |
- | |
377 | void draw(); |
- | |
378 | int click(); |
- | |
379 | } tabs; |
- | |
380 | - | ||
381 | :void _tabs::draw(dword x,y, but_id, text) |
- | |
382 | { |
- | |
383 | dword col_bg, col_text; |
- | |
384 | dword w=strlen(text)*8+TAB_PADDING, h=TAB_HEIGHT; |
- | |
385 | y -= h; |
- | |
386 | - | ||
387 | if (but_id==active_tab) |
- | |
388 | { |
- | |
389 | col_bg=system.color.work_button; |
- | |
390 | col_text=system.color.work_button_text; |
- | |
391 | } |
- | |
392 | else |
- | |
393 | { |
- | |
394 | col_bg=system.color.work; |
- | |
395 | col_text=system.color.work_text; |
- | |
396 | } |
- | |
397 | DrawCaptButton(x,y, w-1,h+1, but_id, col_bg, col_text, text); |
- | |
398 | } |
- | |
399 | - | ||
400 | :int _tabs::click(int N) |
- | |
401 | { |
- | |
402 | if (N==active_tab) return false; |
- | |
403 | active_tab = N; |
- | |
404 | return true; |
- | |
405 | } |
- | |
406 | - | ||
407 | /*========================================================= |
- | |
408 | == |
- | |
409 | == MORE LESS BOX |
- | |
410 | == |
- | |
411 | /========================================================*/ |
- | |
412 | - | ||
413 | :struct more_less_box |
- | |
414 | { |
- | |
415 | signed x,y; |
- | |
416 | unsigned value, min, max; |
- | |
417 | unsigned bt_id_more, bt_id_less; |
- | |
418 | dword text; |
- | |
419 | bool click(); |
- | |
420 | void draw(); |
- | |
421 | }; |
- | |
422 | - | ||
423 | :bool more_less_box::click(unsigned id) |
- | |
424 | { |
- | |
425 | if (id==bt_id_less) { value = math.max(value-1, min); draw(); return 1; } |
- | |
426 | if (id==bt_id_more) { value = math.min(value+1, max); draw(); return 1; } |
- | |
427 | return 0; |
- | |
428 | } |
- | |
429 | - | ||
430 | :void more_less_box::draw() |
- | |
431 | { |
- | |
432 | #define VALUE_FIELD_W 34 |
- | |
433 | #define SIZE 18 |
- | |
434 | dword value_text = itoa(value); |
- | |
435 | - | ||
436 | DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph); |
- | |
437 | DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff); |
- | |
438 | DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff); |
- | |
439 | WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text); |
- | |
440 | - | ||
441 | DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+"); |
- | |
442 | DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-"); |
- | |
443 | EDI = system.color.work; |
- | |
444 | WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text); |
- | |
445 | DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); |
- | |
Line 446... | Line 348... | ||
446 | } |
348 | |
447 | 349 |