Subversion Repositories Kolibri OS

Rev

Rev 1714 | Rev 1717 | Go to most recent revision | 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 bl,byte[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], eax, ecx, tree2 ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâ
  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.                 pop eax
  66.                 cmp eax,0
  67.                 je @f
  68.                         mov eax,dword[eax] ;¡¥à¥¬ ¯®à浪®¢ë© ­®¬¥à (¢ ¯ ¬ïâ¨) ¢ë¡à ­­®£® ®¡ê¥ªâ 
  69.                         mov dword[edx+u_object.typid-u_object],eax
  70.                 @@:
  71.  
  72.                 ;ãáâ ­®¢ª  «®£¨ç¥áª¨å ᢮©áâ¢
  73.                 mov edi,ch1.flags
  74.                 mov eax,1
  75.                 xor ebx,ebx
  76.                 @@:
  77.                         bt dword[edi],1
  78.                         jnc .opt_no_sel
  79.                                 or ebx,eax ;­ ª®¯«¥­¨¥ ®â¬¥ç¥­­ëå ®¯æ¨©
  80.                         .opt_no_sel:
  81.                         shl eax,1
  82.                         add edi,ch_struc_size
  83.                         cmp edi,check_boxes_end
  84.                 jl @b
  85.                 mov dword[edx+u_object.modif-u_object],ebx
  86.                 popad
  87.         .err_obj:
  88.         call draw_constructor ;®¡­®¢«ï¥¬ ®ª­® ª®­áâàãªâ®à 
  89.         ;call draw_window
  90.         ret
  91.  
  92. ;input:
  93. ; ebx - property column
  94. ; edi - pointer to property editbox
  95. align 4
  96. get_obj_win_param:
  97.         pushad
  98.                 mov esi,ed_text
  99.                 stdcall get_obj_text_col, [foc_obj], ebx ;edx - ᬥ饭¨¥ ¤«ï ⥪áâ 
  100.                 stdcall get_obj_text_len_col, [foc_obj], ebx ;eax - ¤«¨­­  ¯®«ï
  101.                 cld
  102.                 mov edi,edx
  103.                 mov ecx,eax
  104.                 rep movsb
  105.         popad
  106.         ret
  107.  
  108. ;input:
  109. ;  obj - pointer to object
  110. ;  ind - column index
  111. ;output:
  112. ;  edx + offset
  113. ;  edx = 0 if not text
  114. align 4
  115. proc get_obj_text_col, obj:dword, ind:dword
  116.         mov edx,dword[obj]
  117.         inc edx ;goto text
  118. push ebx
  119.         mov ebx,dword[ind]
  120.         cmp bx,0
  121.         je .end_fun
  122.  
  123.         shl ebx,8 ;¢ bh ¯®¯ ¤ ¥â ­®¬¥à ¨áª®¬®© ª®«®­ª¨
  124.         mov bl,byte[edx-1] ;¢ bl ¯®¯ ¤ ¥â ª®¤ ®¡ê¥ªâ 
  125.  
  126.         push ecx edi
  127.         call find_obj_in_opt ;¨é¥¬ áâàãªâãàã á ®¯æ¨ï¬¨ ®¡ê¥ªâ 
  128.  
  129.         add edi,obj_opt.Col-obj_opt
  130.         dec bh
  131.         and ebx,0xff00
  132.         shr ebx,7 ;ᤢ¨£ ¥¬ ­  7, â.ª. ­ã¦­® §­ ç¥­¨¥ bh 㬭®¦¥­­®¥ ­  2
  133.         add edi,ebx ;+ ¡ë¢è¥¥ bh*2
  134.         xor ecx,ecx
  135.         mov cx,word[edi] ;ecx - ᤨ£ ¤«ï ¨áª®¬®£® ¯®«ï
  136.         add edx,ecx
  137.  
  138.         cmp cx,0
  139.         jg @f
  140.                 mov edx,0 ;not text
  141.         @@:
  142.         cmp cx,MAX_LEN_OBJ_TXT
  143.         jl @f
  144.                 mov edx,0 ;not text
  145.         @@:
  146.  
  147.         pop edi ecx
  148.         .end_fun:
  149. pop ebx
  150.         ret
  151. endp
  152.  
  153. ;input:
  154. ;  obj - 㪠§ â¥«ì ­  ®¡ê¥ªâ
  155. ;  ind - ­®¬¥à ¯®«ï ¢­ãâਠ®¡ê¥ªâ 
  156. ;output:
  157. ;  eax - ¤«¨­­  ⥪á⮢®£® ¯®«ï ¢­ãâਠ®¡ê¥ªâ 
  158. align 4
  159. proc get_obj_text_len_col, obj:dword, ind:dword
  160.         xor eax,eax
  161. push ebx
  162.         mov ebx,dword[ind]
  163.         shl ebx,8 ;¢ bh ¯®¯ ¤ ¥â ­®¬¥à ¨áª®¬®© ª®«®­ª¨
  164.         mov eax,dword[obj]
  165.         mov bl,byte[eax] ;¢ bl ¯®¯ ¤ ¥â ª®¤ ®¡ê¥ªâ 
  166.         xor eax,eax
  167.  
  168.         push edi
  169.         call find_obj_in_opt ;¨é¥¬ áâàãªâãàã á ®¯æ¨ï¬¨ ®¡ê¥ªâ 
  170.  
  171.         add edi,obj_opt.Col-obj_opt
  172.         and ebx,0xff00
  173.         shr ebx,7 ;ᤢ¨£ ¥¬ ­  7, â.ª. ­ã¦­® §­ ç¥­¨¥ bh 㬭®¦¥­­®¥ ­  2
  174.         add edi,ebx ;+ ¡ë¢è¥¥ bh*2
  175.  
  176.         mov ax,word[edi] ;eax - ᤨ£ ¤«ï á«¥¤ã饣® ¯®«ï
  177.         cmp ax,0
  178.         jg @f
  179.                 mov eax,MAX_LEN_OBJ_TXT ;¯®á«¥¤­¨¥ ¯®«ï ¤«ï 㤮¡á⢠ ª®¤¨àãîâáï 0,   ­¥ MAX_LEN_OBJ_TXT, ¨á¯à ¢«ï¥¬ á¨âã æ¨î
  180.         @@:
  181.         cmp dword[ind],0
  182.         je .end_fun ;¤«ï ¯¥à¢®£® ¯®«ï ᤨ£ = 0, ¯®â®¬ã ¢ áâàãªâãॠ®­ ­¥ åà ­¨âáï, â.ª. ¨§¢¥á⥭ § à ­¥¥
  183.         sub ax,word[edi-2] ;®â­¨¬ ¥¬ ᤨ£ ¤«ï ¨áª®¬®£® ¯®«ï, ¯®«ãç ¥¬ ¤«¨­­ã ¯®«ï
  184.  
  185.         cmp word[edi-2],0
  186.         jg @f
  187.                 mov eax,0 ;¯®«¥ ¯ãá⮥, ­¥ ¨á¯®«ì§ã¥âáï
  188.         @@:
  189.         cmp ax,MAX_LEN_OBJ_TXT
  190.         jl @f
  191.                 mov eax,0 ;not text
  192.         @@:
  193.  
  194.         pop edi
  195.         .end_fun:
  196. pop ebx
  197.         ret
  198. endp
  199.  
  200. align 4
  201. proc draw_obj_icon, o_type:dword,n_col:dword, coord_y:dword
  202.         pushad
  203.         xor ebx,ebx
  204.         mov bl,byte[o_type]
  205.         call find_obj_in_opt
  206.  
  207.         add edi,obj_opt.img-obj_opt ;get index (+0)
  208.         mov ebx,[n_col]
  209.         shl ebx,1
  210.         add edi,ebx ;move index (+bh)
  211.         xor ecx,ecx
  212.         mov cx,[edi]
  213.  
  214.         cmp cx,0
  215.         jge @f
  216.                 jmp .end_fun ;error icon index
  217.         @@:
  218.  
  219.         mov ebx,bmp_icon
  220.         imul ecx,0x300
  221.         add ebx,ecx
  222.  
  223.         mov eax,7
  224.         mov ecx,0x100010 ;ecx - size:16*16
  225.         mov edx,3 ;®âáâ㯠®â «¥¢®£® ªà ï à ¬ª¨ ¤® ¨ª®­ª¨
  226.         shl edx,16
  227.         add edx,[coord_y]
  228.         int 0x40
  229.         .end_fun:
  230.         popad
  231.         ret
  232. endp
  233.  
  234. ;¢ë¢®¤ ⥪áâ  á ¯®¤¯¨áìî
  235. align 4
  236. proc draw_obj_caption, o_type:dword,n_col:dword, coord_y:dword
  237.         pushad
  238.         stdcall get_obj_text_len_col, [foc_obj], [n_col] ;eax - ¤«¨­­  ¯®«ï
  239.         cmp eax,1
  240.         jl .no_draw
  241.  
  242.         xor ebx,ebx
  243.         mov bl,byte[o_type]
  244.         call find_obj_in_opt
  245.  
  246.         mov edx,edi
  247.         add edx,obj_opt.caption-obj_opt
  248.  
  249.         mov eax,[n_col]
  250.         mov ebx,150
  251.         shl ebx,16
  252.         add ebx,dword[coord_y]
  253.         add ebx,3
  254.         mov ecx,0 ;text color
  255.  
  256.         mov esi,edx
  257.         .beg_found:
  258.                 cmp byte[esi],0
  259.                 je .end_found
  260.                 cmp byte[esi],'*'
  261.                 je @f
  262.                 inc esi
  263.                 jmp .beg_found
  264.         @@:
  265.         cmp eax,0
  266.         je .end_found
  267.                 dec eax
  268.                 inc esi
  269.                 mov edx,esi ;¯¥à¥ª«îç ¥¬ ­ ç «® áâப¨ ­  á«¥¤. ¯®¤¯¨áì
  270.                 jmp .beg_found
  271.         .end_found:
  272.         cmp esi,edx
  273.         jle .no_draw
  274.                 sub esi,edx ;esi = text len
  275.                 mov eax,4
  276.                 int 0x40
  277.         .no_draw:
  278.         popad
  279.         ret
  280. endp
  281.  
  282. align 4
  283. proc draw_icon, ind:dword,coord_x:dword,coord_y:dword
  284.         pushad
  285.         mov ecx,[ind]
  286.         cmp ecx,0
  287.         jl .end_fun
  288.                 mov ebx,bmp_icon
  289.                 imul ecx,0x300
  290.                 add ebx,ecx
  291.  
  292.                 mov eax,7
  293.                 mov ecx,0x100010 ;ecx - size:16*16
  294.                 mov edx,[coord_x]
  295.                 shl edx,16
  296.                 add edx,[coord_y]
  297.                 int 0x40
  298.         .end_fun:
  299.         popad
  300.         ret
  301. endp
  302.  
  303. ;input
  304. ;  bl = cod object
  305. ;output:
  306. ;  edi = pointer to option struct
  307. align 4
  308. find_obj_in_opt:
  309.         push ecx
  310.         xor ecx,ecx ;find 'bl' in options
  311.         mov edi,obj_opt
  312.         @@:
  313.                 cmp bl,[edi] ;find
  314.                 je @f
  315.                 inc ecx
  316.                 cmp ecx,MAX_OBJ_TYPES
  317.                 je @f ;not find
  318.                 add edi,sizeof.ObjOpt
  319.                 jmp @b
  320.         @@:
  321.         pop ecx
  322.         ret
  323.  
  324.  
  325. obj_find_last dd 0 ;㪠§ â¥«ì ­  ¯®á«¥¤­¨© 㤠筮 ­ ©¤¥­­ë© ®¡ê¥ªâ,
  326.         ;­ã¦¥­ ¤«ï ã᪮७¨ï ¯®á«¥¤ã饣® ¯®¨áª 
  327.  
  328. ;¢ë室:
  329. ;eax - 㪠§ â¥«ì ­  áâàãªâãàã ­ ©¤¥­­®£® ®¡ê¥ªâ 
  330. align 4
  331. proc find_obj_in_file, o_type:dword
  332. push ebx esi
  333.         mov ebx,[o_type]
  334.         stdcall dword[tl_node_poi_get_info], 0,tree2
  335.         pop esi
  336.  
  337.         @@:
  338.                 cmp esi,0
  339.                 je .find_no
  340.  
  341.                 stdcall dword[tl_node_poi_get_data], esi,tree2
  342.                 pop eax ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
  343.                 cmp eax,0
  344.                 je .find_no
  345.  
  346.                 cmp byte[eax],bl ;ᬮâਬ ®¯¨á ­ «¨ ¨áª®¬ë© ®¡ê¥ªâ ¢ 㧫¥
  347.                 je .find_yes
  348.  
  349.                 stdcall dword[tl_node_poi_get_next_info], esi,tree2
  350.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  351.  
  352.                 jmp @b
  353.  
  354.         .find_yes:
  355.                 mov dword[obj_find_last],esi
  356.                 jmp @f
  357.         .find_no:
  358.                 mov dword[obj_find_last],0
  359.                 xor eax,eax
  360.         @@:
  361. pop esi ebx
  362.         ret
  363. endp
  364.  
  365. ;¢ë室:
  366. ;eax - 㪠§ â¥«ì ­  áâàãªâãàã ­ ©¤¥­­®£® ®¡ê¥ªâ 
  367. align 4
  368. proc find_obj_in_file_next, o_type:dword
  369. push ebx esi
  370.         cmp dword[obj_find_last],0
  371.         je .find_no
  372.  
  373.         mov ebx,[o_type]
  374.  
  375.         stdcall dword[tl_node_poi_get_next_info], dword[obj_find_last],tree2
  376.         pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  377.  
  378.         @@:
  379.                 cmp esi,0
  380.                 je .find_no
  381.  
  382.                 stdcall dword[tl_node_poi_get_data], esi,tree2
  383.                 pop eax ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
  384.                 cmp eax,0
  385.                 je .find_no
  386.  
  387.                 cmp byte[eax],bl ;ᬮâਬ ®¯¨á ­ «¨ ¨áª®¬ë© ®¡ê¥ªâ ¢ 㧫¥
  388.                 je .find_yes
  389.  
  390.                 stdcall dword[tl_node_poi_get_next_info], esi, tree2
  391.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  392.  
  393.                 jmp @b
  394.  
  395.         .find_yes:
  396.                 mov dword[obj_find_last],esi
  397.                 jmp @f
  398.         .find_no:
  399.                 mov dword[obj_find_last],0
  400.                 xor eax,eax
  401.         @@:
  402. pop esi ebx
  403.         ret
  404. endp
  405.  
  406. align 4
  407. but_show_constructor:
  408.         mov byte[show_mode],0
  409.         stdcall [buf2d_draw], buf_fon
  410.         ret
  411.  
  412. align 4
  413. but_show_code:
  414.         mov byte[show_mode],1
  415.         stdcall [ted_draw], tedit0
  416.         ret
  417.  
  418. ;input:
  419. ; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
  420. ;output:
  421. ; eax - ç¨á«®
  422. align 4
  423. proc conv_str_to_int, buf:dword
  424.         xor eax,eax
  425.         push ebx esi
  426.         xor ebx,ebx
  427.         mov esi,[buf]
  428.         cmp word[esi],'0x'
  429.         je .load_digit_16
  430.  
  431.         .load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
  432.                 mov bl,byte[esi]
  433.                 cmp bl,'0'
  434.                 jl @f
  435.                 cmp bl,'9'
  436.                 jg @f
  437.                         sub bl,'0'
  438.                         imul eax,10
  439.                         add eax,ebx
  440.                         inc esi
  441.                         jmp .load_digit_10
  442.         jmp @f
  443.  
  444.         .load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
  445.                 add esi,2
  446.         .cycle_16:
  447.                 mov bl,byte[esi]
  448.                 cmp bl,'0'
  449.                 jl @f
  450.                 cmp bl,'f'
  451.                 jg @f
  452.                 cmp bl,'9'
  453.                 jle .us1
  454.                         cmp bl,'A'
  455.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
  456.                 .us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
  457.                 cmp bl,'F'
  458.                 jle .us2
  459.                         cmp bl,'a'
  460.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
  461.                         sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
  462.                 .us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
  463.                         sub bl,'0'
  464.                         cmp bl,9
  465.                         jle .cor1
  466.                                 sub bl,7 ;convert 'A' to '10'
  467.                         .cor1:
  468.                         shl eax,4
  469.                         add eax,ebx
  470.                         inc esi
  471.                         jmp .cycle_16
  472.         @@:
  473.  
  474.         pop esi ebx
  475.         ret
  476. endp
  477.