Subversion Repositories Kolibri OS

Rev

Rev 1705 | Rev 1711 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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