Subversion Repositories Kolibri OS

Rev

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