Palitra: refactoring, add shared icons

Move t_edit into separate folder


git-svn-id: svn://kolibrios.org@9472 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-12-26 00:49:38 +00:00
parent 19836de888
commit 3d623894c9
9 changed files with 115 additions and 79 deletions

View File

@ -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, {

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -1,4 +1,5 @@
@fasm.exe palitra.asm palitra
@kpack palitra
del palitra
@fasm.exe palitra.asm palitra
rem @kpack palitra
pause
if not exist palitra ( @pause )

View File

@ -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 ; <20>ˆ“…Œ <20>ˆ<CB86>
call draw_result ; <20>ˆ“…Œ <20>…‡“œ
; ”ã­ªæ¨ï 8 - ®¯à¥¤¥«¨âì/㤠«¨âì ª­®¯ªã
mcall SF_DEFINE_BUTTON, (110 shl 16)+147, (9 shl 16)+147, 0x60000007
mcall SF_DEFINE_BUTTON, <110,147>, <DRAWY,147>, 0x07+BT_HIDE
inc edx
mcall , 18*65536+22, 61*65536+188 ; <20>¨á㥬 ­¥¢¨¤¨¬ãî ª­®¯ªã ¯®¤ á« ©¤¥à®¬ red
add ebx,20*65536+20 ;23 shl 16 ; „®¡ ¢«ï¥¬
add edx,1++BT_NOFRAME
mcall , <10,22>, <62,128> ; <20>¨á㥬 ­¥¢¨¤¨¬ãî ª­®¯ªã ¯®¤ á« ©¤¥à®¬ red
add ebx,25*65536 ; „®¡ ¢«ï¥¬
inc edx ; ID = 9
int 0x40 ; <20>¨á㥬 ­¥¢¨¤¨¬ãî ª­®¯ªã ¯®¤ á« ©¤¥à®¬ green
add ebx,20*65536+20;23 shl 16 ; „®¡ ¢«ï¥¬
add ebx,25*65536 ; „®¡ ¢«ï¥¬
inc edx ; ID = 10
int 0x40 ; <20>¨á㥬 ­¥¢¨¤¨¬ãî ª­®¯ªã ¯®¤ á« ©¤¥à®¬ blue
add ebx, 20*65536+20;23 shl 16 ; „®¡ ¢«ï¥¬
add ebx,25*65536 ; „®¡ ¢«ï¥¬
inc edx ; ID = 11
int 0x40 ; <20>¨á㥬 ­¥¢¨¤¨¬ãî ª­®¯ªã ¯®¤ á« ©¤¥à®¬ alpha
; ”ã­ªæ¨ï 8 - ®¯à¥¤¥«¨âì/㤠«¨âì ª­®¯ªã (Œ…<C592>€ –‚…’€)
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
;#___________________________________________________________________________________________________
;****************************************************************************************************|
; <20>ŽŠ <E2809A>ŽŒŽƒ€œ<E280B9><20><>Ž…„“<E2809E> ˆ ”“<E2809D>Šˆ<20><>ˆŽ†…<E280A0>ˆŸ |
@ -300,14 +332,27 @@ draw_main:
draw_left_panel: ; Žâà¨á®¢ª  ¡®ª®¢®© ¯ ­¥«¨ SL97: <20>  á ¬®¬ ¤¥«¥ ¯à ¢®©.
;.................................................................................................
; button_next_colorsheme
mcall SF_DEFINE_BUTTON, (266 shl 16)+16, (9 shl 16)+16, 0x6000000C, [sc.work_button]
mcall SF_DEFINE_BUTTON, <ICONX,21>, <DRAWY,21>, 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>, <ICONX+2,DRAWY+2>, 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:
;.................................................................................................
; <20>®«ìè ï à ¬ª  ¢ë¢®¤  १ã«ìâ â 
;.................................................................................................
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
; <20>ŽŠ <20><EFBFBD>…Œ…<C592><E280A6>ˆ ŠŽ<C5A0><E28099> |
;----------------------------------------------------------------------------------------------------/
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:

View File

@ -160,9 +160,6 @@ draw_window:
mcall SF_DEFINE_BUTTON, <WIN_W-35,32>, <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

View File

@ -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