Subversion Repositories Kolibri OS

Rev

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