From ceaabc7ffaf2499619ac19ba052d54416fcdca36 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sat, 13 Feb 2016 15:26:28 +0000 Subject: [PATCH] calc: a bit more flexible GUI git-svn-id: svn://kolibrios.org@6215 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/gui_patterns.inc | 20 +++++++++++++++++ programs/other/calc/trunk/calc.asm | 35 ++++++++++++------------------ programs/system/end/light/end.asm | 14 +----------- 3 files changed, 35 insertions(+), 34 deletions(-) create mode 100644 programs/gui_patterns.inc diff --git a/programs/gui_patterns.inc b/programs/gui_patterns.inc new file mode 100644 index 0000000000..ad808674dc --- /dev/null +++ b/programs/gui_patterns.inc @@ -0,0 +1,20 @@ +macro DrawBar x, y, width, height, color +{ + mcall 13, (x) shl 16 + (width), (y) shl 16 + (height), color +} + +macro DrawRectangle x, y, w, h, color +{ + DrawBar x,y,w,1,color + DrawBar x,y+h,w,1 + DrawBar x,y,1,h + DrawBar x+w,y,1,h+1 +} + +macro DrawRectangle3D x, y, w, h, color1, color2 +{ + DrawBar x,y,w,1,color1 + DrawBar x,y,1,h + DrawBar x,y+h,w,1,color2 + DrawBar x+w,y,1,h+1 +} \ No newline at end of file diff --git a/programs/other/calc/trunk/calc.asm b/programs/other/calc/trunk/calc.asm index 68ac474918..327c460007 100644 --- a/programs/other/calc/trunk/calc.asm +++ b/programs/other/calc/trunk/calc.asm @@ -32,21 +32,9 @@ use32 dd 0x0,0x0 ; I_Param , I_Icon include '../../../macros.inc' +include '../../../gui_patterns.inc' include '../../../KOSfuncs.inc' -macro DrawBar x, y, width, height, color -{ - mcall 13, (x) shl 16 + (width), (y) shl 16 + (height), color -} - -macro DrawRectangle x, y, w, h, color -{ - DrawBar x,y,w,1,color - DrawBar x,y+h,w,1 - DrawBar x,y,1,h - DrawBar x+w,y,1,h+1 -} - START: red: call draw_window @@ -649,6 +637,10 @@ atof_convertFractionalPart: ; ********************************************* BTNSP_X equ 39 +DISPLAY_X equ 20 +DISPLAY_Y equ 18 +DISPLAY_W equ 208 +DISPLAY_H equ 26 draw_window: mcall 12, 1 @@ -684,7 +676,7 @@ no_new_row: jbe newbutton mcall , <253, 36>, <55, 22>, 2, 0xF0969D ; 'C' - mcall , <235,54>, <20,26>, 3, [sc.work] ; 'dec-bin-hex' + mcall , <236,53>, , 3, [sc.work] ; 'dec-bin-hex' mov esi, [sc.work_button] @@ -721,16 +713,17 @@ next_button: print_display: pusha - mcall 13, < 21, 206>, <22, 24>, 0xFFFfff - DrawRectangle 19,20,208,26, [sc.work_graph] - mcall 38, < 20, 226>, <21, 21>, 0xE0E0E0 ; internal shadow - mcall 38, < 20, 20>, <23, 43>, 0xE0E0E0 ; internal shadow + DrawRectangle3D DISPLAY_X-1,DISPLAY_Y-1,DISPLAY_W+2,DISPLAY_H+2, [sc.work_3d_dark], [sc.work_3d_light] + DrawRectangle DISPLAY_X,DISPLAY_Y,DISPLAY_W,DISPLAY_H, [sc.work_graph] + mcall 38, < DISPLAY_X+1, DISPLAY_W+DISPLAY_X-1>, , 0xE0E0E0 ; internal shadow + mcall , < DISPLAY_X+1, DISPLAY_X+1>, , ; internal shadow + mcall 13, < DISPLAY_X+2, DISPLAY_W-2>, , 0xFFFfff ; background mov ecx, [sc.work_text] or ecx, 0x40000000 - mcall 4, <135,7>,,calc,1,[sc.work] + mcall 4, <135,6>,,calc,1,[sc.work] - mov ebx, 250 shl 16 + 26 + mov ebx, 250 shl 16 + DISPLAY_Y+(DISPLAY_H-14)/2 mov edx, [display_type] shl edx, 2 add edx, display_type_text @@ -810,7 +803,7 @@ clear_all: ;data -title db 'Calc 1.4', 0 +title db 'Calc 1.41', 0 display_type dd 0 ; 0 = decimal, 1 = hexadecimal, 2= binary entry_multiplier dd 10 diff --git a/programs/system/end/light/end.asm b/programs/system/end/light/end.asm index df5c7652b2..5d877fc694 100644 --- a/programs/system/end/light/end.asm +++ b/programs/system/end/light/end.asm @@ -22,22 +22,10 @@ include '../../../proc32.inc' include '../../../dll.inc' include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../../gui_patterns.inc' @use_library -macro DrawBar x, y, width, height, color -{ - mcall 13, (x) shl 16 + (width), (y) shl 16 + (height), color -} - -macro DrawRectangle x, y, w, h, color -{ - DrawBar x,y,w,1,color - DrawBar x,y+h,w,1 - DrawBar x,y,1,h - DrawBar x+w,y,1,h+1 -} - align 4 START: