Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5387 → Rev 5388

/programs/media/voxel_editor/utilites/vox_mover.asm
15,9 → 15,10
include '../../../../programs/dll.inc'
include '../trunk/vox_draw.inc'
include '../trunk/vox_rotate.inc'
include '../trunk/str.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Voxel mover 13.09.12',0 ;¯®¤¯¨áì ®ª­ 
caption db 'Voxel mover 29.01.15',0 ;¯®¤¯¨áì ®ª­ 
 
struct FileInfoBlock
Function dd ?
32,7 → 33,6
run_file_70 FileInfoBlock
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
 
fn_toolbar db 'toolbar_m.png',0
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*18
image_data_toolbar dd 0
174,7 → 174,7
 
stdcall [buf2d_vox_brush_create], buf_vox, vox_6_7_z
 
load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
load_image_file 'toolbar_m.png', image_data_toolbar,IMAGE_TOOLBAR_SIZE
 
stdcall mem.Alloc,[max_open_file_size]
mov dword[open_file_vox],eax
352,16 → 352,11
; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
mov edx,[sc.work]
or edx,(3 shl 24)+0x30000000
mov edi,caption
mcall 0,dword[wnd_s_pos],dword[wnd_s_pos+4]
mcall 0,dword[wnd_s_pos],dword[wnd_s_pos+4],,,caption
 
; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
mov eax,8
mov ebx,(5 shl 16)+20
mov ecx,(5 shl 16)+20
mov edx,3
mov esi,[sc.work_button]
int 0x40
mcall 8,(5 shl 16)+20,(5 shl 16)+20,3
 
mov ebx,(30 shl 16)+20
mov edx,4
416,11 → 411,8
int 0x40
 
; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
mov eax,7
mov ebx,[image_data_toolbar]
mov ecx,(16 shl 16)+16
mov edx,(7 shl 16)+7 ;icon new
int 0x40
mcall 7,[image_data_toolbar],(16 shl 16)+16
 
add ebx,IMAGE_TOOLBAR_ICON_SIZE
add edx,(25 shl 16) ;icon open
485,14 → 477,10
 
align 4
draw_pok:
mov eax,47
mov ecx,[v_zoom]
mov ebx,(3 shl 16)+(1 shl 31)
mov edx,((350+6*9) shl 16)+OT_CAPT_Y_COLOR+2
mov esi,[sc.work_button_text]
or esi,(1 shl 30)
mov edi,[sc.work_button]
int 0x40 ;¬ áèâ ¡
mcall 47, (3 shl 16)+(1 shl 31), [v_zoom], ((350+6*9) shl 16)+OT_CAPT_Y_COLOR+2 ;¬ áèâ ¡
mov ecx,[n_plane]
add edx,115 shl 16 ;9
int 0x40 ;­®¬¥à á¥ç¥­¨ï
501,11 → 489,11
mov dword[txt_curor.size],0
mov eax,dword[v_cur_x]
mov edi,txt_curor.size
call convert_int_to_str
stdcall convert_int_to_str,10
stdcall str_cat, edi,txt_mull
mov eax,dword[v_cur_y]
mov edi,txt_buf
call convert_int_to_str
stdcall convert_int_to_str,16
stdcall str_cat, txt_curor.size,edi
stdcall str_cat, txt_curor.size,txt_space ;§ ¢¥àè î騩 ¯à®¡¥«
 
513,25 → 501,23
mov dword[txt_mov_offs.size],0
mov eax,dword[mov_x]
mov edi,txt_mov_offs.size
call convert_int_to_str
stdcall convert_int_to_str,30
stdcall str_cat, edi,txt_space
mov eax,dword[mov_y]
mov edi,txt_buf
call convert_int_to_str
stdcall convert_int_to_str,16
stdcall str_cat, txt_mov_offs.size,edi
stdcall str_cat, txt_mov_offs.size,txt_space
mov eax,dword[mov_z]
mov edi,txt_buf
call convert_int_to_str
stdcall convert_int_to_str,16
stdcall str_cat, txt_mov_offs.size,edi
stdcall str_cat, txt_mov_offs.size,txt_space ;§ ¢¥àè î騩 ¯à®¡¥«
 
mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
mov ebx,(OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2
;à¨á®¢ ­¨¥ ⥪áâ 
mov ecx,[sc.work_text]
or ecx,0x80000000 ;or (1 shl 30)
mov edx,txt_color
int 0x40
mcall 4, (OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2,,txt_color
 
mov edx,txt_curor
add ebx,115 shl 16
559,16 → 545,14
pushad
mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;¯® ®á¨ x
mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;¯® ®á¨ y
mov edx,[v_color]
mcall 13
mcall 13,,,[v_color]
 
mov ebx,(1 shl 8)+(6 shl 16)
mov ecx,edx
mov edx,((OT_CAPT_X_COLOR+55) shl 16)+OT_CAPT_Y_COLOR+2
mov esi,[sc.work_text]
add esi,(1 shl 30)
mov edi,[sc.work]
mcall 47
mcall 47,(1 shl 8)+(6 shl 16)
popad
ret
 
1319,151 → 1303,7
popad
ret
 
if 0
;input:
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
;output:
; eax - ç¨á«®
align 4
proc conv_str_to_int, buf:dword
xor eax,eax
push ebx ecx esi
xor ebx,ebx
mov esi,[buf]
;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
xor ecx,ecx
inc ecx
cmp byte[esi],'-'
jne @f
dec ecx
inc esi
@@:
 
cmp word[esi],'0x'
je .load_digit_16
 
.load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'9'
jg @f
sub bl,'0'
imul eax,10
add eax,ebx
inc esi
jmp .load_digit_10
jmp @f
 
.load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
add esi,2
.cycle_16:
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'f'
jg @f
cmp bl,'9'
jle .us1
cmp bl,'A'
jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
.us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
cmp bl,'F'
jle .us2
cmp bl,'a'
jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
.us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
sub bl,'0'
cmp bl,9
jle .cor1
sub bl,7 ;convert 'A' to '10'
.cor1:
shl eax,4
add eax,ebx
inc esi
jmp .cycle_16
@@:
cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
jne @f
sub ecx,eax
mov eax,ecx
@@:
pop esi ecx ebx
ret
endp
end if
 
;input:
; eax = value
; edi = string buffer
;output:
align 4
convert_int_to_str:
pushad
bt eax,31
jae @f
;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
neg eax
;inc eax
;clc
mov byte[edi],'-'
inc edi
@@:
mov dword[edi+1],0
mov word[edi+5],0
call .str
popad
ret
 
align 4
.str:
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
jb @f
xor edx,edx ;®ç¨áâ¨âì edx
div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
push edx ;¯®«®¦¨âì ¢ á⥪
;dec edi ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
pop eax
@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
 
align 4
proc str_cat, str1:dword, str2:dword
push eax ecx edi esi
mov esi,dword[str2]
stdcall str_len,esi
mov ecx,eax
inc ecx
mov edi,dword[str1]
stdcall str_len,edi
add edi,eax
cld
repne movsb
pop esi edi ecx eax
ret
endp
 
;output:
; eax = strlen
align 4
proc str_len, str1:dword
mov eax,[str1]
@@:
cmp byte[eax],0
je @f
inc eax
jmp @b
@@:
sub eax,[str1]
ret
endp
 
;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
align 4
OpenDialog_data:
1744,6 → 1584,7
db 6,7,4,3 ;w,h,h_osn,n
rb BUF_STRUCT_SIZE*(3+1)
 
align 16
i_end:
wnd_s_pos: ;¬¥áâ® ¤«ï ­ áâ஥ª áâ à⮢®© ¯®§¨æ¨¨ ®ª­ 
rq 0