Subversion Repositories Kolibri OS

Rev

Rev 1717 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. ;¯®¤­¨¬ ¥¬ ®¡ê¥ªâ ¢¢¥àå ¯® ᯨáªã
  3. align 4
  4. but_obj_move_up:
  5.         stdcall [tl_node_move_up], tree2
  6.         ret
  7.  
  8. ;®¯ã᪠¥¬ ®¡ê¥ªâ ¢­¨§ ¯® ᯨáªã
  9. align 4
  10. but_obj_move_down:
  11.         stdcall [tl_node_move_down], tree2
  12.         ret
  13.  
  14. ;ª®¯¨à㥬 ®¡ê¥ªâ
  15. align 4
  16. but_obj_copy:
  17. push ecx esi edi
  18.         stdcall [tl_node_get_data], tree2
  19.         pop esi
  20.         mov edi,[tree2.data_info] ;¤ ­­ë¥ 0-£® 㧫 , ¨á¯®«ì§ã¥¬ ¤«ï ª®¯¨à®¢ ­¨ï
  21.         xor ecx,ecx
  22.         mov cx,word[tree2.info_size]
  23.         cld
  24.         rep movsb
  25. pop edi esi ecx
  26.         ret
  27.  
  28. ;¢áâ ¢«ï¥¬ ®¡ê¥ªâ
  29. align 4
  30. but_obj_paste:
  31. push eax ebx ecx edi
  32.         mov eax,[tree2.data_info] ;¤ ­­ë¥ 0-£® 㧫 , ¨á¯®«ì§ã¥¬ ¤«ï ª®¯¨à®¢ ­¨ï
  33.         mov ebx,dword[eax]
  34.         call find_obj_in_opt
  35.         xor ecx,ecx
  36.         mov cx,word[edi+obj_opt.img-obj_opt] ;cx - ¨­¤¥ªá £« ¢­®© ¨ª®­ª¨ ¤®¡ ¢«ï¥¬®£® ®¡ê¥ªâ 
  37.         shl ecx,16
  38.         stdcall [tl_node_add], tree2,ecx,eax ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâ
  39.         stdcall [tl_draw], tree2
  40. pop edi ecx ebx eax
  41.         ret
  42.  
  43. ;®¡­®¢«¥­¨¥ ®¡ê¥ªâ®¢ ¢ tree2, ¯® §­ ç¥­¨ï¬ ⥪á⮢ëå ¯®«¥©
  44. ;äã­ªæ¨ï ®¡à â­ ï ª ¤ ­­®© on_file_object_select
  45. align 4
  46. but_element_change:
  47.         ;foc_obj - 㪠§ â¥«ì ­  ¯®á«¥¤­¨© ¢ë¡à ­­ë© 㧥« ¢ tree2
  48.         cmp dword[foc_obj],0
  49.         je .err_obj
  50.                 pushad
  51.                 ;ãáâ ­®¢ª  ⥪á⮢ëå ᢮©áâ¢
  52.                 xor ebx,ebx
  53.                 mov edi,edit2
  54.                 @@:
  55.                         call get_obj_win_param
  56.                         inc ebx
  57.                         add edi,ed_struc_size
  58.                         cmp edi,prop_wnd_edits_end
  59.                 jl @b
  60.  
  61.                 ;ãáâ ­®¢ª  áá뫪¨ ­  ®¡ê¥ªâ ⨯ 
  62.                 mov edx,dword[foc_obj]
  63.                 mov dword[edx+u_object.typid-u_object],0 ;­  á«ãç © ¥á«¨ ­¨ç¥£® ­¥ ¢ë¡à ­®
  64.                 stdcall [tl_node_get_data],tree3
  65.                 cmp eax,0
  66.                 je @f
  67.                         mov eax,dword[eax] ;¡¥à¥¬ ¯®à浪®¢ë© ­®¬¥à (¢ ¯ ¬ïâ¨) ¢ë¡à ­­®£® ®¡ê¥ªâ 
  68.                         mov dword[edx+u_object.typid-u_object],eax
  69.                 @@:
  70.  
  71.                 ;ãáâ ­®¢ª  «®£¨ç¥áª¨å ᢮©áâ¢
  72.                 mov edi,ch1.flags
  73.                 mov eax,1
  74.                 xor ebx,ebx
  75.                 @@:
  76.                         bt dword[edi],1
  77.                         jnc .opt_no_sel
  78.                                 or ebx,eax ;­ ª®¯«¥­¨¥ ®â¬¥ç¥­­ëå ®¯æ¨©
  79.                         .opt_no_sel:
  80.                         shl eax,1
  81.                         add edi,ch_struc_size
  82.                         cmp edi,check_boxes_end
  83.                 jl @b
  84.                 mov dword[edx+u_object.modif-u_object],ebx
  85.                 popad
  86.         .err_obj:
  87.         call draw_constructor ;®¡­®¢«ï¥¬ ®ª­® ª®­áâàãªâ®à 
  88.         ;call draw_window
  89.         ret
  90.  
  91. ;input:
  92. ; ebx - property column
  93. ; edi - pointer to property editbox
  94. align 4
  95. get_obj_win_param:
  96.         pushad
  97.                 mov esi,ed_text
  98.                 stdcall get_obj_text_col, [foc_obj], ebx ;edx - ᬥ饭¨¥ ¤«ï ⥪áâ 
  99.                 stdcall get_obj_text_len_col, [foc_obj], ebx ;eax - ¤«¨­­  ¯®«ï
  100.                 cld
  101.                 mov edi,edx
  102.                 mov ecx,eax
  103.                 rep movsb
  104.         popad
  105.         ret
  106.  
  107. ;input:
  108. ;  obj - pointer to object
  109. ;  ind - column index
  110. ;output:
  111. ;  edx + offset
  112. ;  edx = 0 if not text
  113. align 4
  114. proc get_obj_text_col, obj:dword, ind:dword
  115.         mov edx,dword[obj]
  116.         add edx,4 ;goto text
  117. push ebx ecx
  118.         mov ecx,dword[ind]
  119.         cmp cx,0
  120.         je .end_fun
  121.  
  122.         mov ebx,dword[edx-4] ;¢ ebx ¯®¯ ¤ ¥â ª®¤ ®¡ê¥ªâ 
  123.  
  124.         push edi
  125.         call find_obj_in_opt ;¨é¥¬ áâàãªâãàã á ®¯æ¨ï¬¨ ®¡ê¥ªâ 
  126.  
  127.         add edi,obj_opt.Col-obj_opt
  128.         dec ecx
  129.         shl ecx,1 ;㬭®¦ ¥¬ ­  2
  130.         add edi,ecx ;+ ind*2
  131.         xor ecx,ecx
  132.         mov cx,word[edi] ;ecx - ᤨ£ ¤«ï ¨áª®¬®£® ¯®«ï
  133.         add edx,ecx
  134.  
  135.         cmp cx,0
  136.         jg @f
  137.                 mov edx,0 ;not text
  138.         @@:
  139.         cmp cx,MAX_LEN_OBJ_TXT
  140.         jl @f
  141.                 mov edx,0 ;not text
  142.         @@:
  143.  
  144.         pop edi
  145.         .end_fun:
  146. pop ecx ebx
  147.         ret
  148. endp
  149.  
  150. ;input:
  151. ;  obj - 㪠§ â¥«ì ­  ®¡ê¥ªâ
  152. ;  ind - ­®¬¥à ¯®«ï ¢­ãâਠ®¡ê¥ªâ 
  153. ;output:
  154. ;  eax - ¤«¨­­  ⥪á⮢®£® ¯®«ï ¢­ãâਠ®¡ê¥ªâ 
  155. align 4
  156. proc get_obj_text_len_col uses ebx ecx edi, obj:dword, ind:dword
  157.         xor eax,eax
  158.         mov ecx,dword[ind]
  159.         mov eax,dword[obj]
  160.         mov ebx,dword[eax] ;¢ ebx ¯®¯ ¤ ¥â ª®¤ ®¡ê¥ªâ 
  161.         xor eax,eax
  162.  
  163.         call find_obj_in_opt ;¨é¥¬ áâàãªâãàã á ®¯æ¨ï¬¨ ®¡ê¥ªâ 
  164.  
  165.         add edi,obj_opt.Col-obj_opt
  166.         shl ecx,1 ;㬭®¦ ¥¬ ­  2
  167.         add edi,ecx ;+ ind*2
  168.  
  169.         mov ax,word[edi] ;eax - ᤨ£ ¤«ï á«¥¤ã饣® ¯®«ï
  170.         cmp ax,0
  171.         jg @f
  172.                 mov eax,MAX_LEN_OBJ_TXT ;¯®á«¥¤­¨¥ ¯®«ï ¤«ï 㤮¡á⢠ ª®¤¨àãîâáï 0,   ­¥ MAX_LEN_OBJ_TXT, ¨á¯à ¢«ï¥¬ á¨âã æ¨î
  173.         @@:
  174.         cmp dword[ind],0
  175.         je .end_fun ;¤«ï ¯¥à¢®£® ¯®«ï ᤨ£ = 0, ¯®â®¬ã ¢ áâàãªâãॠ®­ ­¥ åà ­¨âáï, â.ª. ¨§¢¥á⥭ § à ­¥¥
  176.         sub ax,word[edi-2] ;®â­¨¬ ¥¬ ᤨ£ ¤«ï ¨áª®¬®£® ¯®«ï, ¯®«ãç ¥¬ ¤«¨­­ã ¯®«ï
  177.  
  178.         cmp word[edi-2],0
  179.         jg @f
  180.                 mov eax,0 ;¯®«¥ ¯ãá⮥, ­¥ ¨á¯®«ì§ã¥âáï
  181.         @@:
  182.         cmp ax,MAX_LEN_OBJ_TXT
  183.         jl @f
  184.                 mov eax,0 ;not text
  185.         @@:
  186.  
  187.         .end_fun:
  188.         ret
  189. endp
  190.  
  191. align 4
  192. proc draw_obj_icon, o_type:dword,n_col:dword, coord_y:dword
  193.         pushad
  194.         xor ebx,ebx
  195.         mov ebx,dword[o_type]
  196.         call find_obj_in_opt
  197.  
  198.         add edi,obj_opt.img-obj_opt ;get index (+0)
  199.         mov ebx,[n_col]
  200.         shl ebx,1
  201.         add edi,ebx ;move index (+bh)
  202.         xor ecx,ecx
  203.         mov cx,[edi]
  204.  
  205.         cmp cx,0
  206.         jge @f
  207.                 jmp .end_fun ;error icon index
  208.         @@:
  209.  
  210.         mov ebx,bmp_icon
  211.         imul ecx,0x300
  212.         add ebx,ecx
  213.  
  214.         mov eax,7
  215.         mov ecx,0x100010 ;ecx - size:16*16
  216.         mov edx,3 ;®âáâ㯠®â «¥¢®£® ªà ï à ¬ª¨ ¤® ¨ª®­ª¨
  217.         shl edx,16
  218.         add edx,[coord_y]
  219.         int 0x40
  220.         .end_fun:
  221.         popad
  222.         ret
  223. endp
  224.  
  225. align 4
  226. proc draw_icon, ind:dword,coord_x:dword,coord_y:dword
  227.         pushad
  228.         mov ecx,[ind]
  229.         cmp ecx,0
  230.         jl .end_fun
  231.                 mov ebx,bmp_icon
  232.                 imul ecx,0x300
  233.                 add ebx,ecx
  234.  
  235.                 mov eax,7
  236.                 mov ecx,0x100010 ;ecx - size:16*16
  237.                 mov edx,[coord_x]
  238.                 shl edx,16
  239.                 add edx,[coord_y]
  240.                 int 0x40
  241.         .end_fun:
  242.         popad
  243.         ret
  244. endp
  245.  
  246. ;input
  247. ;  ebx = cod object
  248. ;output:
  249. ;  edi = pointer to option struct
  250. align 4
  251. find_obj_in_opt:
  252.         push ecx
  253.         xor ecx,ecx ;find 'ebx' in options
  254.         mov edi,obj_opt
  255.         @@:
  256.                 cmp ebx,dword[edi] ;find
  257.                 je @f
  258.                 inc ecx
  259.                 cmp ecx,MAX_OBJ_TYPES
  260.                 je @f ;not find
  261.                 add edi,sizeof.ObjOpt
  262.                 jmp @b
  263.         @@:
  264.         pop ecx
  265.         ret
  266.  
  267.  
  268. obj_find_last dd 0 ;㪠§ â¥«ì ­  ¯®á«¥¤­¨© 㤠筮 ­ ©¤¥­­ë© ®¡ê¥ªâ,
  269.         ;­ã¦¥­ ¤«ï ã᪮७¨ï ¯®á«¥¤ã饣® ¯®¨áª 
  270.  
  271. ;¢ë室:
  272. ;eax - 㪠§ â¥«ì ­  áâàãªâãàã ­ ©¤¥­­®£® ®¡ê¥ªâ 
  273. align 4
  274. proc find_obj_in_file, o_type:dword
  275. push ebx esi
  276.         mov ebx,[o_type]
  277.         stdcall dword[tl_node_poi_get_info], tree2,0
  278.         mov esi,eax
  279.  
  280.         @@:
  281.                 cmp esi,0
  282.                 je .find_no
  283.  
  284.                 stdcall dword[tl_node_poi_get_data], tree2,esi ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
  285.                 cmp eax,0
  286.                 je .find_no
  287.  
  288.                 cmp dword[eax],ebx ;ᬮâਬ ®¯¨á ­ «¨ ¨áª®¬ë© ®¡ê¥ªâ ¢ 㧫¥
  289.                 je .find_yes
  290.  
  291.                 stdcall dword[tl_node_poi_get_next_info], tree2,esi
  292.                 mov esi,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  293.  
  294.                 jmp @b
  295.  
  296.         .find_yes:
  297.                 mov dword[obj_find_last],esi
  298.                 jmp @f
  299.         .find_no:
  300.                 mov dword[obj_find_last],0
  301.                 xor eax,eax
  302.         @@:
  303. pop esi ebx
  304.         ret
  305. endp
  306.  
  307. ;¢ë室:
  308. ;eax - 㪠§ â¥«ì ­  áâàãªâãàã ­ ©¤¥­­®£® ®¡ê¥ªâ 
  309. align 4
  310. proc find_obj_in_file_next uses ebx esi, o_type:dword
  311.         cmp dword[obj_find_last],0
  312.         je .find_no
  313.  
  314.         mov ebx,dword[o_type]
  315.  
  316.         stdcall dword[tl_node_poi_get_next_info], tree2,dword[obj_find_last]
  317.         mov esi,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  318.  
  319.         @@:
  320.                 cmp esi,0
  321.                 je .find_no
  322.  
  323.                 stdcall dword[tl_node_poi_get_data], tree2,esi ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
  324.                 cmp eax,0
  325.                 je .find_no
  326.  
  327.                 cmp dword[eax],ebx ;ᬮâਬ ®¯¨á ­ «¨ ¨áª®¬ë© ®¡ê¥ªâ ¢ 㧫¥
  328.                 je .find_yes
  329.  
  330.                 stdcall dword[tl_node_poi_get_next_info], tree2,esi
  331.                 mov esi,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  332.  
  333.                 jmp @b
  334.  
  335.         .find_yes:
  336.                 mov dword[obj_find_last],esi
  337.                 jmp @f
  338.         .find_no:
  339.                 mov dword[obj_find_last],0
  340.                 xor eax,eax
  341.         @@:
  342.         ret
  343. endp
  344.  
  345. align 4
  346. but_show_constructor:
  347.         mov byte[show_mode],0
  348.         stdcall [buf2d_draw], buf_fon
  349.         ret
  350.  
  351. align 4
  352. but_show_code:
  353.         mov byte[show_mode],1
  354.         stdcall [ted_draw], tedit0
  355.         ret
  356.  
  357. ;input:
  358. ; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
  359. ;output:
  360. ; eax - ç¨á«®
  361. align 4
  362. proc conv_str_to_int, buf:dword
  363.         xor eax,eax
  364.         push ebx esi
  365.         xor ebx,ebx
  366.         mov esi,[buf]
  367.         cmp word[esi],'0x'
  368.         je .load_digit_16
  369.  
  370.         .load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
  371.                 mov bl,byte[esi]
  372.                 cmp bl,'0'
  373.                 jl @f
  374.                 cmp bl,'9'
  375.                 jg @f
  376.                         sub bl,'0'
  377.                         imul eax,10
  378.                         add eax,ebx
  379.                         inc esi
  380.                         jmp .load_digit_10
  381.         jmp @f
  382.  
  383.         .load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
  384.                 add esi,2
  385.         .cycle_16:
  386.                 mov bl,byte[esi]
  387.                 cmp bl,'0'
  388.                 jl @f
  389.                 cmp bl,'f'
  390.                 jg @f
  391.                 cmp bl,'9'
  392.                 jle .us1
  393.                         cmp bl,'A'
  394.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
  395.                 .us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
  396.                 cmp bl,'F'
  397.                 jle .us2
  398.                         cmp bl,'a'
  399.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
  400.                         sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
  401.                 .us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
  402.                         sub bl,'0'
  403.                         cmp bl,9
  404.                         jle .cor1
  405.                                 sub bl,7 ;convert 'A' to '10'
  406.                         .cor1:
  407.                         shl eax,4
  408.                         add eax,ebx
  409.                         inc esi
  410.                         jmp .cycle_16
  411.         @@:
  412.  
  413.         pop esi ebx
  414.         ret
  415. endp
  416.