keybi, simple paint: use skinned windows

git-svn-id: svn://kolibrios.org@6165 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-02-07 19:54:43 +00:00
parent 7c44fcb552
commit b7c1c94b59
4 changed files with 55 additions and 99 deletions

View File

@ -21,20 +21,29 @@
;******************************************************************************
; <20>®¤ª«îç ¥¬ ­¥®¡å®¤¨¬ë¥ ¬ ªà®áë
include 'macros.inc'
include '../../../macros.inc'
;******************************************************************************
; <20>€—€Ž <20><>Žƒ<C5BD>€ŒŒ
meos_app_start
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; title version
dd START ; start of code
dd I_END ; size of image
dd E_END ; memory for app
dd E_END ; esp
dd 0x0,0x0 ; I_Param , I_Icon
; Ž<>œ ŠŽ„€
code
START:
mov eax,40 ; á®®¡é¨¬ á¨á⥬¥, ª ª¨¥ ᮡëâ¨ï ¡ã¤¥¬ ®¡à ¡ â뢠âì
mov ebx,0100101b ; ¬ áª  ᮡë⨩ - ¯¥à¥à¨á®¢ª  (1) + ª­®¯ª  (3) + ¬ëèì (6
int 0x40 ; íâ  ª®¬ ­¤  ¢ë§ë¢ ¥â á¨á⥬­ãî äã­ªæ¨î
mov [workarea.cx],10 ; ª®®à¤¨­ âë à ¡®ç¥© (ª«¨¥­â᪮©) ®¡« áâ¨
mov [workarea.cy],45 ; ¤«ï à¨á®¢ ­¨ï
mov [workarea.cx],5 ; ª®®à¤¨­ âë à ¡®ç¥© (ª«¨¥­â᪮©) ®¡« áâ¨
mov [workarea.cy],30 ; ¤«ï à¨á®¢ ­¨ï
red:
call draw_window ; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª­ 
@ -152,9 +161,7 @@ still: ;
mov [mouse_pressed],1
; <20>®«ã稬 ª®®à¤¨­ âë ªãàá®à  ¬ëè¨ (®â­®á¨â¥«ì­® ®ª­ )
mov eax,37 ; äã­ªæ¨ï 37 - ¯®«ãç¨âì á®áâ®ï­¨¥ ¬ëè¨
mov ebx,1 ; ¯®¤äã­ªæ¨ï 1
int 0x40
mcall 37,1 ; ¯®«ãç¨âì á®áâ®ï­¨¥ ¬ëè¨
; <20>¥à¥¤¥« ¥¬ ¨å â ª, çâ®¡ë ®­¨ ¡ë«¨ ¢ à §­ëå ॣ¨áâà å, â.¥. eax ¨ ebx
mov ebx,eax
@ -202,9 +209,9 @@ still: ;
;******************************************************************************
save_canvas:
mov eax,[process.x_size]
mov eax,[proc_info.box.width]
add eax,[workarea.cx]
mov ebx,[process.y_size]
mov ebx,[proc_info.box.height]
add ebx,[workarea.cy]
jmp still
@ -217,71 +224,35 @@ save_canvas:
draw_window:
mov eax,48 ; <20>Ž„ƒ<E2809E>“†€…Œ ˆ…Œ<E280A6>… –‚…’€
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
mcall 48,3,sc,sizeof.system_colors ; <20>Ž„ƒ<E2809E>“†€…Œ ˆ…Œ<E280A6>… –‚…’€
mcall 12, 1 ; ­ ç «® ®âà¨á®¢ª¨ ®ª­ 
mov edx, [sc.work]
or edx, 0x33000000
mcall 0, (100 shl 16)+400, (100 shl 16)+300, , , title ; à¨á㥬 ®ª­®
mcall 12, 1
mov eax,12 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
mov ebx,1 ; 1, ­ ç¨­ ¥¬ à¨á®¢ âì
int 0x40
mcall 9,proc_info,-1 ; ¯®«ã稬 ¨­ä®à¬ æ¨î ® ᢮¥¬ ¯®â®ª¥
; ‘Ž‡„€ðŒ ŽŠ<C5BD>Ž
mov eax,0 ; äã­ªæ¨ï 0 : ®¯à¥¤¥«¨âì ¨ ®âà¨á®¢ âì ®ª­®
mov ebx,100*65536+400 ; [x áâ àâ] *65536 + [x à §¬¥à]
mov ecx,100*65536+300 ; [y áâ àâ] *65536 + [y à §¬¥à]
mov edx,[sc.work] ; 梥â à ¡®ç¥© ®¡« á⨠RRGGBB,8->color gl
or edx,0x02000000
mov esi,[sc.grab] ; 梥⠯®«®áë § £®«®¢ª  RRGGBB,8->color gl
or esi,0x80000000
mov edi,[sc.frame] ; 梥â à ¬ª¨ RRGGBB
int 0x40
mov eax,[proc_info.box.width] ; ­ áâந¬ à §¬¥à à ¡®ç¥© ®¡« áâ¨
sub eax,20 ; (å à §¬¥à ®ª­  - 20)
mov [workarea.sx],eax
mov eax,[proc_info.box.height]
sub eax,63 ; (ã à §¬¥à - 63)
mov [workarea.sy],eax
mov eax,9 ; ¯®«ã稬 ¨­ä®à¬ æ¨î ® ᥡ¥
mov ebx,process
mov ecx,-1
int 0x40
mov eax,[process.x_size] ; ­ áâந¬ à §¬¥à à ¡®ç¥© ®¡« áâ¨
add eax,-20 ; (å à §¬¥à ®ª­  - 20)
mov [workarea.sx],eax ;
mov eax,[process.y_size] ;
add eax,-60 ; (ã à §¬¥à - 60)
mov [workarea.sy],eax ;
; ‡€ƒŽ‹Ž‚ŽŠ ŽŠ<C5BD>
mov eax,4 ; äã­ªæ¨ï 4 : ­ ¯¨á âì ¢ ®ª­¥ ⥪áâ
mov ebx,8*65536+8 ; [x] *65536 + [y]
mov ecx,[sc.grab_text] ; 梥â
or ecx,0x10000000 ; èà¨äâ
mov edx,header ;  ¤à¥á áâப¨
mov esi,header_len ; ¨ ¥ñ ¤«¨­ 
int 0x40
; Š<>Ž<EFBFBD>Š€ ‡€Š<E282AC>ˆŸ ŽŠ<C5BD>
mov eax,8 ; äã­ªæ¨ï 8 : ®¯à¥¤¥«¨âì ¨ ­ à¨á®¢ âì ª­®¯ªã
; mov ebx,(300-19)*65536+12 ; [x áâ àâ] *65536 + [x à §¬¥à]
mov ebx,[process.x_size]
add ebx,-19
shl ebx,16
add ebx,12
mov ecx,5*65536+12 ; [y áâ àâ] *65536 + [y à §¬¥à]
mov edx,1 ; ¨¤¥­â¨ä¨ª â®à ª­®¯ª¨
mov esi,[sc.grab_button] ; 梥⠪­®¯ª¨ RRGGBB
int 0x40
cmp [process.y_size],80
cmp [proc_info.box.height],80
jb .finish
mov eax, 8
mov edx, 1
; ᮧ¤ ñ¬ ª­®¯ª¨ ¢ë¡®à  梥â :
mov ebx,10*65536+10 ; ­ ç «ì­ ï x ª®®à¤¨­ â  ¨ à §¬¥à
mov ecx,27*65536+10 ; ­ ç «ì­ ï y ª®®à¤¨­ â  & size
mov ebx,10*65536+15 ; ­ ç «ì­ ï x ª®®à¤¨­ â  ¨ à §¬¥à
mov ecx, 7*65536+15 ; ­ ç «ì­ ï y ª®®à¤¨­ â  & size
.new_button:
inc edx ; ¨¤¥­â¨ä¨ª â®à++;
mov esi,[btn_colors-8+edx*4] ; 梥⠪­®¯ª¨
int 0x40 ; áâ ¢¨¬ ª­®¯ªã
add ebx,12*65536 ; á«¥¤ãîé ï ª­®¯ª  ¯à ¢¥¥ ­  12
add ebx,18*65536 ; á«¥¤ãîé ï ª­®¯ª  ¯à ¢¥¥ ­  12
cmp edx,9 ; áà ¢­¨¢ ¥¬ edx (¨¤¥­â¨ä¨ª â®à) á 9
jbe .new_button ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­® -> ¥éñ ®¤­ã ª¯®ªã
@ -293,24 +264,19 @@ draw_window:
add ebx,[workarea.sx]
add ecx,[workarea.sy]
mov edx,0xffffff
int 0x40
mcall 13
.finish:
mov eax,12 ; á®®¡é ¥¬ á¨á⥬¥ ® § ¢¥à襭¨¨ ®âà¨á®¢ª¨ ®ª­ 
mov ebx,2
int 0x40
ret
;******************************************************************************
; ­ ç «® ®¡« á⨠¨­¨æ¨ «¨§¨à®¢ ­­ëå ¤ ­­ëå
; ¥á«¨ ªâ® ¥éñ ­¥ §­ ¥â, çâ® §­ ç¨â "¨­¨æ¨ «¨§¨à®¢ ­­ë¥", â® ¯®ïá­ïî:
; í⮠⥠¤ ­­ë¥, ª®â®àë¬ ¯à¨á¢®¥­® ­ ç «ì­®¥ §­ ç¥­¨¥
data
header: ; áâப  § £®«®¢ª 
db 'PAINT v0.2 for MenuetOS'
header_len = $ - header ; ¨ ¥ñ ¤«¨­ 
;data
title db 'Simple Paint v0.3',0
mouse_pressed db 0 ; ¯®ª §ë¢ ¥â, ­ ¦ â  «¨ ¡ë«  ¬ëèì ¢ ¯à¥¤ë¤ã騩 ¬®¬¥­â
@ -343,7 +309,7 @@ colors:
; §¤¥áì ¤ ­­ë¬ §­ ç¥­¨ï ­¥ ¯à¨á¢®¥­ë. ®â«¨ç¨¥ ®â ¨­¨æ., ­¥ 㢥«¨ç¨¢ îâ à §¬¥à
; ä ©« 
udata
I_END:
active_color dd ? ;  ªâ¨¢­ë© 梥â
@ -357,9 +323,9 @@ udata
.sy dd ?
sc system_colors ; á¨á⥬­ë¥ 梥â 
process process_information ; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áá¥
proc_info process_information ; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áá¥
restflag dd ?
canvas rb 800*600*3
meos_app_end
E_END:

View File

@ -0,0 +1,2 @@
@fasm paint.asm paint
@pause

View File

@ -1,3 +1,5 @@
fasm keybi.asm keybi
kpack keybi
pause
@erase lang.inc
@echo lang fix en >lang.inc
@fasm keybi.asm keybi
@erase lang.inc
@pause

View File

@ -81,23 +81,9 @@ align 4
draw_window:
pushad
mcall 12,1
xor eax,eax
mov ebx,(10 shl 16)+100
mov ecx,(10 shl 16)+75
mov edx,[sc.work]
or edx,(2 shl 24)+0x10000000+0x20000000
mov edi,[sc.grab] ;[sc.frame]
mov esi,[sc.grab]
int 0x40
mov eax,8
mov ebx,(80 shl 16)+10
mov cx,-15
shl ecx,16
mov cx,10
mov edx,1
mov esi,[sc.grab_button]
int 0x40
mov edx, [sc.work]
or edx, 0x34000000
mcall 0, (10 shl 16)+100, (10 shl 16)+75
stdcall [check_box_draw], ch1
stdcall [check_box_draw], ch2