From 3d623894c9c1d071aef2cd59478d974477f76391 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 26 Dec 2021 00:49:38 +0000 Subject: [PATCH] Palitra: refactoring, add shared icons Move t_edit into separate folder git-svn-id: svn://kolibrios.org@9472 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 20 ++-- data/common/settings/assoc.ini | 2 +- programs/gui_patterns.inc | 20 ---- programs/macros.inc | 7 +- programs/media/palitra/branch/build.bat | 7 +- programs/media/palitra/branch/palitra.asm | 131 +++++++++++++++------- programs/media/palitra/branch/panel.raw | Bin 7152 -> 0 bytes programs/system/end/light/end.asm | 3 - programs/testing/cpuid/trunk/CPUID.ASM | 4 +- 9 files changed, 115 insertions(+), 79 deletions(-) delete mode 100644 programs/media/palitra/branch/panel.raw diff --git a/data/Tupfile.lua b/data/Tupfile.lua index 04fb231752..b164c4bcde 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -292,22 +292,22 @@ extra_files = { {"kolibrios/utils/man2html", "common/utils/MAN2HTML"}, {"kolibrios/utils/vmode", "common/vmode"}, {"kolibrios/utils/texture", "common/utils/texture"}, - {"kolibrios/utils/t_edit.ini", PROGS .. "/other/t_edit/t_edit.ini"}, {"kolibrios/utils/cnc_editor/cnc_editor", PROGS .. "/other/cnc_editor/cnc_editor"}, {"kolibrios/utils/cnc_editor/kolibri.NC", PROGS .. "/other/cnc_editor/kolibri.NC"}, - {"kolibrios/utils/info/ASM.SYN", PROGS .. "/other/t_edit/info/asm.syn"}, - {"kolibrios/utils/info/CPP_CLA.SYN", PROGS .. "/other/t_edit/info/cpp_kol_cla.syn"}, - {"kolibrios/utils/info/CPP_DAR.SYN", PROGS .. "/other/t_edit/info/cpp_kol_dar.syn"}, - {"kolibrios/utils/info/CPP_DEF.SYN", PROGS .. "/other/t_edit/info/cpp_kol_def.syn"}, - {"kolibrios/utils/info/DEFAULT.SYN", PROGS .. "/other/t_edit/info/default.syn"}, - {"kolibrios/utils/info/HTML.SYN", PROGS .. "/other/t_edit/info/html.syn"}, - {"kolibrios/utils/info/INI.SYN", PROGS .. "/other/t_edit/info/ini_files.syn"}, {"kolibrios/utils/kfm/kfm.ini", "common/File Managers/kfm.ini"}, {"kolibrios/utils/kfm/kfm_keys_eng.txt", PROGS .. "/fs/kfm/trunk/docs/english/kfm_keys.txt"}, {"kolibrios/utils/kfm/kfm_keys_rus.txt", PROGS .. "/fs/kfm/trunk/docs/russian/dos_kolibri/kfm_keys.txt"}, {"kolibrios/utils/NDN/", "common/File Managers/ndn/*"}, {"kolibrios/utils/NDN/COLORS/", "common/File Managers/ndn/COLORS/*"}, {"kolibrios/utils/NDN/XLT/", "common/File Managers/ndn/XLT/*"}, + {"kolibrios/utils/t_edit/t_edit.ini", PROGS .. "/other/t_edit/t_edit.ini"}, + {"kolibrios/utils/t_edit/info/ASM.SYN", PROGS .. "/other/t_edit/info/asm.syn"}, + {"kolibrios/utils/t_edit/info/CPP_CLA.SYN", PROGS .. "/other/t_edit/info/cpp_kol_cla.syn"}, + {"kolibrios/utils/t_edit/info/CPP_DAR.SYN", PROGS .. "/other/t_edit/info/cpp_kol_dar.syn"}, + {"kolibrios/utils/t_edit/info/CPP_DEF.SYN", PROGS .. "/other/t_edit/info/cpp_kol_def.syn"}, + {"kolibrios/utils/t_edit/info/DEFAULT.SYN", PROGS .. "/other/t_edit/info/default.syn"}, + {"kolibrios/utils/t_edit/info/HTML.SYN", PROGS .. "/other/t_edit/info/html.syn"}, + {"kolibrios/utils/t_edit/info/INI.SYN", PROGS .. "/other/t_edit/info/ini_files.syn"}, } if build_type == "rus" then tup.append_table(extra_files, { {"Docs/cp866/config.txt", build_type .. "/docs/CONFIG.TXT"}, @@ -605,10 +605,10 @@ tup.append_table(extra_files, { {"kolibrios/media/zsea/plugins/convert.obj", PROGS .. "/media/zsea/plugins/convert/convert.obj"}, {"kolibrios/media/zsea/plugins/rotate.obj", PROGS .. "/media/zsea/plugins/rotate/rotate.obj"}, {"kolibrios/media/zsea/plugins/scaling.obj", PROGS .. "/media/zsea/plugins/scaling/scaling.obj"}, + {"kolibrios/utils/AMDtemp", PROGS .. "/system/amd_temp_view/AMDtemp"}, {"kolibrios/utils/calcplus", PROGS .. "/other/calcplus/calcplus"}, {"kolibrios/utils/kfm/kfm", PROGS .. "/fs/kfm/trunk/kfm"}, - {"kolibrios/utils/t_edit", PROGS .. "/other/t_edit/t_edit"}, - {"kolibrios/utils/AMDtemp", PROGS .. "/system/amd_temp_view/AMDtemp"}, + {"kolibrios/utils/t_edit/t_edit", PROGS .. "/other/t_edit/t_edit"}, }) -- For russian build, add russian-only programs. if build_type == "rus" then tup.append_table(img_files, { diff --git a/data/common/settings/assoc.ini b/data/common/settings/assoc.ini index 4d82026d97..7d7ea801b4 100644 --- a/data/common/settings/assoc.ini +++ b/data/common/settings/assoc.ini @@ -68,7 +68,7 @@ exec=/kolibrios/utils/thashview icon=124 [TextEdit] -exec=/kolibrios/utils/t_edit +exec=/kolibrios/utils/t_edit/t_edit icon=9 next=$CodeEdit diff --git a/programs/gui_patterns.inc b/programs/gui_patterns.inc index d518b2f104..a372747507 100644 --- a/programs/gui_patterns.inc +++ b/programs/gui_patterns.inc @@ -1,12 +1,3 @@ -BT_DEL equ 0x80000000 -BT_HIDE equ 0x40000000 -BT_NOFRAME equ 0x20000000 - -macro DefineButton x, y, w, h, id, background_color -{ - mcall 8, (x) shl 16 + (w), (y) shl 16 + (h), id, background_color -} - macro DrawBar x, y, width, height, color { mcall 13, (x) shl 16 + (width), (y) shl 16 + (height), color @@ -36,15 +27,4 @@ macro DrawWideRectangle x, y, w, h, boder, color DrawBar x+w-boder, y+boder, boder, h-boder-boder } -macro WriteText x, y, fontType, color, text -{ - mcall 4, (x) shl 16 + (y), (fontType) shl 24 + (color), text -} - -macro WriteTextBold x, y, fontType, color, text -{ - mcall 4, (x) shl 16 + (y), (fontType) shl 24 + (color), text - add ebx,1 shl 16 - mcall -} diff --git a/programs/macros.inc b/programs/macros.inc index feb72aebe7..c3342acb46 100644 --- a/programs/macros.inc +++ b/programs/macros.inc @@ -569,6 +569,11 @@ irp cond, e, ne, g, ng, l, nl, ge, le { ; constants +; button flags +BT_DEL = 0x80000000 +BT_HIDE = 0x40000000 +BT_NOFRAME = 0x20000000 + ; events EV_IDLE = 0 EV_TIMER = 0 @@ -593,5 +598,5 @@ EVM_STACK = 10000000b EVM_DEBUG = 100000000b EVM_STACK2 = 1000000000b -EVM_MOUSE_FILTER = 0x80000000 +EVM_MOUSE_FILTER = 0x80000000 EVM_CURSOR_FILTER = 0x40000000 diff --git a/programs/media/palitra/branch/build.bat b/programs/media/palitra/branch/build.bat index 5c25890f93..2fbc7e1056 100644 --- a/programs/media/palitra/branch/build.bat +++ b/programs/media/palitra/branch/build.bat @@ -1,4 +1,5 @@ -@fasm.exe palitra.asm palitra -@kpack palitra +del palitra +@fasm.exe palitra.asm palitra +rem @kpack palitra -pause \ No newline at end of file +if not exist palitra ( @pause ) \ No newline at end of file diff --git a/programs/media/palitra/branch/palitra.asm b/programs/media/palitra/branch/palitra.asm index 681341a1b0..90dd8ab04c 100644 --- a/programs/media/palitra/branch/palitra.asm +++ b/programs/media/palitra/branch/palitra.asm @@ -74,20 +74,27 @@ include '../../../KOSfuncs.inc' include '../../../dll.inc' - WIN_W equ 394 ; ширина окна - WIN_H equ 251 ; высота окна - WIN_X equ 250 ; координата х окна - WIN_Y equ 190 ; координата у окна - -panel: - file "panel.raw" + WIN_W = 394 ; ширина окна + WIN_H = 251 ; высота окна + WIN_X = 250 ; координата х окна + WIN_Y = 190 ; координата у окна + + CELLW = 8 ; not used yet, but has to be :) + DRAWY = 9 + ICONX = WIN_W - 35 + SLIDEW = 25 START: mcall SF_SYS_MISC,SSF_HEAP_INIT ; инициализация кучи + mcall SF_SYS_MISC, SSF_MEM_OPEN, i18_name + mov [icons18], eax + mcall SF_SYS_MISC, SSF_MEM_OPEN, i18bg_name + mov [icons18bg], eax + stdcall dll.Load, @IMPORT or eax,eax jnz bexit - mcall SF_SET_EVENTS_MASK,0x27 ; устанавливаем маску событий + mcall SF_SET_EVENTS_MASK,EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE ; устанавливаем маску событий include 'params_init.inc' ; обработка параметров командной строки ;#___________________________________________________________________________________________________ @@ -98,13 +105,13 @@ red: call draw_main ; вызываем перерисовку окна приложения still: mcall SF_WAIT_EVENT ; функция 10 - ждать события - cmp eax,1 ; перерисовать окно ? + cmp eax,EV_REDRAW ; перерисовать окно ? je red ; если да - на метку red - cmp eax,2 ; нажата клавиша ? + cmp eax,EV_KEY ; нажата клавиша ? je key ; если да - на key - cmp eax,3 ; нажата кнопка ? + cmp eax,EV_BUTTON ; нажата кнопка ? je button ; если да - на button - cmp eax,6 ; событие от мыши вне окна + cmp eax,EV_MOUSE ; событие от мыши вне окна je mouse ; если да - на button jmp still ; если другое событие - в начало цикла ;end_still @@ -265,23 +272,22 @@ draw_main: call draw_palitra ; РИСУЕМ ПАЛИТРУ call draw_result ; РИСУЕМ РЕЗУЛЬТАТ - ; Функция 8 - определить/удалить кнопку - mcall SF_DEFINE_BUTTON, (110 shl 16)+147, (9 shl 16)+147, 0x60000007 + mcall SF_DEFINE_BUTTON, <110,147>, , 0x07+BT_HIDE - inc edx - mcall , 18*65536+22, 61*65536+188 ; Рисуем невидимую кнопку под слайдером red - add ebx,20*65536+20 ;23 shl 16 ; Добавляем + add edx,1++BT_NOFRAME + mcall , <10,22>, <62,128> ; Рисуем невидимую кнопку под слайдером red + add ebx,25*65536 ; Добавляем inc edx ; ID = 9 int 0x40 ; Рисуем невидимую кнопку под слайдером green - add ebx,20*65536+20;23 shl 16 ; Добавляем + add ebx,25*65536 ; Добавляем inc edx ; ID = 10 int 0x40 ; Рисуем невидимую кнопку под слайдером blue - add ebx, 20*65536+20;23 shl 16 ; Добавляем + add ebx,25*65536 ; Добавляем inc edx ; ID = 11 int 0x40 ; Рисуем невидимую кнопку под слайдером alpha ; Функция 8 - определить/удалить кнопку (СМЕНА ЦВЕТА) - mcall , (13 shl 16)+20, (20 shl 16)+20, 0x6000000D + mcall , <13,19>, <20,18>, 0x0D+BT_HIDE call draw_bottom_panel call draw_left_panel @@ -290,6 +296,32 @@ draw_main: mcall SF_REDRAW,SSF_END_DRAW ret +proc DrawRectangle3D, _x:word, _w:word, _y:word, _h:word, color1:dword, color2:dword + mov ebx,[_w] + add ebx,[_x] ;тут точно какая-то дичь... нужно переписать :) + shl ebx,16 + mov bx,1 + mov ecx,[_h] + inc cx + mov edx,[_color2] + mcall SF_DRAW_RECT ; x+w,y,1,h+1,color2 + rol ebx,16 + sub bx,[_w] + ror ebx,16 + dec cx + mov edx,[_color1] + mcall ;SF_DRAW_RECT x,y,1,h,color1 + mov bx,[_h] + xchg bx,cx + mcall ;SF_DRAW_RECT x,y,w,1,color1 + rol ecx,16 + add cx,[_h] + ror ecx,16 + mov edx,[_color2] + mcall ;SF_DRAW_RECT x,y+h,w,1,color2 + ret +endp + ;#___________________________________________________________________________________________________ ;****************************************************************************************************| ; БЛОК ВСПОМОГАТЕЛЬНЫХ ПРОЦЕДУР И ФУНКЦИЙ ПРИЛОЖЕНИЯ | @@ -300,14 +332,27 @@ draw_main: draw_left_panel: ; Отрисовка боковой панели SL97: На самом деле правой. ;................................................................................................. ; button_next_colorsheme - mcall SF_DEFINE_BUTTON, (266 shl 16)+16, (9 shl 16)+16, 0x6000000C, [sc.work_button] + mcall SF_DEFINE_BUTTON, , , 12+BT_HIDE ; circle diagram add ecx,19 shl 16 ; move rect - mov edx,0x6000000F ; ID = 15 - int 0x40 ; call + add edx,3 ; ID = 15 + mcall - mcall SF_PUT_IMAGE, panel, (16 shl 16)+149, (266 shl 16)+9 + mov ebx,[icons18bg] + add ebx,18*18*4*53 + mcall SF_PUT_IMAGE_EXT, ebx, <18,18>, , 32, 0, 0 + add ebx,18*18*4*(39-53) + mov edx,ICONX*65536+WIN_H-90 + mcall + + mov ebx,[icons18] + add ebx,18*18*4*(52-39) + sub edx,40 + mcall + + ;stdcall DrawRectangle3D ICONX, DRAWY, 22, 22, [sc.work_light], [sc.work_dark] ;Leency: draw rectangle around the button, buggy now + ;mov eax,13 ; draw rect ;mov ebx,266 shl 16+16 ; [x] + [size] ;mov ecx,9 shl 16+16 ; [y] + [size] @@ -788,8 +833,8 @@ draw_result: ;................................................................................................. ; Большая рамка вывода результата ;................................................................................................. - mcall SF_DRAW_RECT, 4 shl 16+110, 9 shl 16+219-18, 0x00666666 - mcall , 5 shl 16+110-2, 10 shl 16+219-20, 0x00F3F3F3 + mcall SF_DRAW_RECT, <4,110>, <9,219-18>, [sc.work_graph] + mcall , <5,110-2>, <10,219-20>, [sc.work_light] ;................................................................................................. ; Отрисовка результата цвета в hex color2 @@ -809,7 +854,7 @@ draw_result: ; Функция 47 - вывод числа в окно ;ebx - параметры преобразования числа в текст (HEX) - mcall SF_DRAW_NUMBER, 256+8 shl 16, [color], (40 shl 16)+22, 0x10000000, 0 + mcall SF_DRAW_NUMBER, 256+8 shl 16, [color], <40,22>, 0x10000000, 0 ; функция 4: написать текст в окне ; edx - рисуем '#' @@ -841,8 +886,9 @@ draw_result: ; Выводим буквы r g b a ;................................................................................................. mov eax,SF_DRAW_TEXT ; 4 - вывести строку текста в окно - mov ebx,19 shl 16+49 ; [координата по оси x]*65536 + [координата по оси y] - mov ecx, 0x0 ; 0xX0RRGGBB (RR, GG, BB задают цвет текста) + mov ebx,17 shl 16+DRAWY+37 ; [координата по оси x]*65536 + [координата по оси y] + mov ecx, 0x10000000 ; 0xX0RRGGBB (RR, GG, BB задают цвет текста) + add ecx, [sc.work_text] mov edx,cname ; указатель на начало строки mov esi,1 ; выводить esi символов newline: ; цикл @@ -876,7 +922,8 @@ draw_value: jne draw_value_e add ebx,7 shl 16 draw_value_e: - mov ecx,0x0; 0x10000000 ; цвет текста RRGGBB + mov ecx,0x0;0x10000000 ; цвет текста RRGGBB + add ecx,[sc.work_text] mov edx,buff ; указатель на начало текста int 0x40 ret ; Возвращаем управление @@ -1091,7 +1138,7 @@ str_len: set_background2: mcall SF_SYS_MISC, SSF_HEAP_INIT mcall SF_SYS_MISC, SSF_MEM_ALLOC, 256 * 256 * 3 - mov [image], eax + mov [bgimg_buf], eax mov edx, eax mov ecx, 256 * 256 @@ -1113,10 +1160,10 @@ set_background2: mcall SF_BACKGROUND_SET, SSF_SIZE_BG, 256, 256 mcall SF_BACKGROUND_SET, SSF_MODE_BG, 1 - mcall SF_BACKGROUND_SET, SSF_IMAGE_BG, [image], 0, 256 * 256 * 3 + mcall SF_BACKGROUND_SET, SSF_IMAGE_BG, [bgimg_buf], 0, 256 * 256 * 3 mcall SF_BACKGROUND_SET, SSF_REDRAW_BG - mcall SF_SYS_MISC, SSF_MEM_FREE, [image] + mcall SF_SYS_MISC, SSF_MEM_FREE, [bgimg_buf] stdcall save_eskin_ini, 'B ' ret @@ -1182,15 +1229,15 @@ endp ; БЛОК ПЕРЕМЕННЫХ И КОНСТАНТ | ;----------------------------------------------------------------------------------------------------/ circle: - title db 'Palitra v0.77',0 ; хранит имя программы + title db 'Palitra v0.77',0 ; хранит имя программы hidden db 'Hidden',0 -; hex db '#',0 ; для вывода решётки как текста +; hex db '#',0 ; для вывода решётки как текста cname db 'RGBAx' ; хранит разряды цветов (red,green,blue) x-метка конца larrow db 0x1A,0 buff db '000',0 bground db 'BACKGROUND',0 ; имя кнопки - 14 - bground1 db 'Gradient',0 ; имя кнопки - 14 - bground2 db 'Noisy',0 ; имя кнопки - 14 + bground1 db 'Gradient',0 ; имя кнопки - 15 + bground2 db 'Noisy',0 ; имя кнопки - 16 runmode dd 1 ; режим запуска (1-normal, 2-hidden, 3-colordialog) color2 dd 00FFFFFFh ; хранит значение второго выбранного цвета @@ -1198,6 +1245,10 @@ circle: amain db 'style',0 aprogram db 'bg_program',0 aparam db 'bg_param',0 + + i18_name db 'ICONS18',0 + i18bg_name db 'ICONS18W',0 + align 16 @IMPORT: @@ -1217,7 +1268,7 @@ I_END: desctop_w rd 1 ; хранит ширину экрана desctop_h rd 1 ; хранит высоту экрана sc system_colors ; хранит структуру системных цветов скина - cred rb 1 ; храним красный спекрт + cred rb 1 ; храним красный спектр cgreen rb 1 ; храним зеленый спектр cblue rb 1 ; храним синий спектр calpha rb 1 ; храним прозрачность @@ -1225,7 +1276,9 @@ I_END: renmode rd 1 ; режим отрисовки (1-цветовая схема,2-пипетка,3-круговая) params rb 20 ; приём параметров params_c rb 9 ; приёмник для цвета - image rd 1 + bgimg_buf rd 1 ; buffer for a generated image + icons18 dd ? ; pointer to a shared memory of icons18.png + icons18bg dd ? ; pointer to a shared memory of icons18.png with filled bg rd 1024 stacktop: diff --git a/programs/media/palitra/branch/panel.raw b/programs/media/palitra/branch/panel.raw deleted file mode 100644 index dd80cfa65aedba0d71f3480b164281e6c312acab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7152 zcmeH{A+Ewe5Qe!14uQj7}d26X*mE81g46LCWP=NZ@F#TL$xnZm7NL0s_j)}jR13ia1H-Ri4j)Ak zz@yPf!|)Yt`T$?ASJ*M!#%oyrOkFhf3Am{bF#MCit_6((>vzJ2KJc&%LF0(^jVtT% zf4u5q?jIJ%3-j3+d$5=4V&f0tX|Kc|jz4%-J8Q`!VX4d;VGdl0KOBELGl&7nBVnn` z8)1&*kv2#BgX7j&OCAYVC69zTdfsRT-+rf`of*V{, <2,22>, CANCEL_BUTTON_ID mcall SF_DEFINE_BUTTON, <32,14>, <70,14>, CHECKBOX_BUTTON_ID mcall SF_DEFINE_BUTTON, <47,WIN_W-47>, <68,34>, CHECKBOX_BUTTON_ID+BT_NOFRAME - ;DefineButton WIN_W-33, 2, 32, 20, CANCEL_BUTTON_ID, 0 - ;DefineButton 32, 70, 14, 14, CHECKBOX_BUTTON_ID, 0 - ;DefineButton 47, 68, WIN_W-47, 34, CHECKBOX_BUTTON_ID+BT_NOFRAME, 0 DrawRectangle3D 32, 70, 14, 14, 0x606060, 0xAFAFAF call draw_checkbox_flag diff --git a/programs/testing/cpuid/trunk/CPUID.ASM b/programs/testing/cpuid/trunk/CPUID.ASM index c75150fe71..f382bd2c2e 100644 --- a/programs/testing/cpuid/trunk/CPUID.ASM +++ b/programs/testing/cpuid/trunk/CPUID.ASM @@ -2281,8 +2281,8 @@ draw_window: Window 150, 150, 350, 405, 0x34FFFFFF, 0x805080d0, title mov esi, [sc.work_button] - DefineButton 138, 345, 92, 24, 2, - DefineButton 238, 345, 92, 24, 3, + mcall SF_DEFINE_BUTTON, <138,92>, <345,24>, 2 + mcall SF_DEFINE_BUTTON, <238,92>, <345,24>, 3 mov ecx, [sc.work_button_text] or ecx, 0x90000000