Subversion Repositories Kolibri OS

Rev

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

  1. ; Keyboard indicators v0.2
  2. ; by Albom and IgorA
  3.  
  4. use32
  5.  org 0
  6.  db 'MENUET01'
  7.  dd 1
  8.  dd _start
  9.  dd _end
  10.  dd _memory
  11.  dd stacktop
  12.  dd 0
  13.  dd sys_path
  14.  
  15. include '../../macros.inc'
  16. include '../../proc32.inc'
  17. include '../../develop/libraries/box_lib/load_lib.mac'
  18. include '../../develop/libraries/box_lib/trunk/box_lib.mac'
  19. ;include 'mem.inc'
  20. ;include 'dll.inc'
  21. include 'lang.inc'
  22.  
  23. @use_library ;_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
  24.  
  25. align 4
  26. _start:
  27.  load_libraries l_libs_start,l_libs_end
  28.  mcall 48,3,sc,sizeof.system_colors
  29.  mcall 40,0x27
  30.  
  31.  init_checkboxes2 check_boxes,check_boxes_end
  32.  check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc
  33.  call _key_set
  34.  
  35. align 4
  36. red_win:
  37.  call draw_window
  38.  
  39.  
  40. align 4
  41. still:
  42.  mcall 10
  43.  
  44.  cmp al,1 ;èçì. ïîëîæåíèå îêíà
  45.  jz red_win
  46.  cmp al,2
  47.  jz key
  48.  cmp al,3
  49.  jz button
  50.  
  51.  ;stdcall [check_box_mouse], ch1
  52.  ;stdcall [check_box_mouse], ch2
  53.  ;stdcall [check_box_mouse], ch3
  54.  
  55.  jmp still
  56.  
  57. ;óñòàíîâèòü îáùåñèñòåìíûå "ãîðÿ÷èå êëàâèøè"
  58. align 4
  59. _key_set:
  60. mov eax, 66
  61. mov ebx, 4
  62. mov edx, 0
  63. mov cl, 69
  64. int 0x40
  65.  
  66. mov eax, 66
  67. mov ebx, 4
  68. mov edx, 0
  69. mov cl, 58
  70. int 0x40
  71.  
  72. mov eax, 66
  73. mov ebx, 4
  74. mov edx, 0
  75. mov cl, 70
  76. int 0x40
  77.  
  78. ret
  79.  
  80. align 4
  81. draw_window:
  82. pushad
  83.  mcall 12,1
  84.  mov edx, [sc.work]
  85.  or  edx, 0x34000000
  86.  mcall 0, (10 shl 16)+100, (10 shl 16)+75
  87.  
  88.  stdcall [check_box_draw], ch1
  89.  stdcall [check_box_draw], ch2
  90.  stdcall [check_box_draw], ch3
  91.  mcall 12,2
  92. popad
  93.  ret
  94.  
  95. align 4
  96. key:
  97.  mcall 2
  98.  call _indicators_check
  99.  jmp still
  100.  
  101. align 4
  102. _indicators_check:
  103. pusha
  104.  mov eax, 66
  105.  mov ebx, 3
  106.  int 40h
  107.  
  108. test_ins:
  109.  test eax, 0x80
  110.  jz @f
  111.  bts dword[ch1.flags],1
  112.  jmp test_caps
  113. @@:
  114.  btr dword[ch1.flags],1
  115.  
  116. test_caps:
  117.  test eax, 0x40
  118.  jz @f
  119.  bts dword[ch2.flags],1
  120.  jmp test_scroll
  121. @@:
  122.  btr dword[ch2.flags],1
  123.  
  124. test_scroll:
  125.  test eax, 0x100
  126.  jz @f
  127.  bts dword[ch3.flags],1
  128.  jmp test_ok
  129. @@:
  130.  btr dword[ch3.flags],1
  131.  
  132. test_ok:
  133.  call draw_window
  134. popa
  135. ret
  136.  
  137. align 4
  138. button:
  139.  mcall 17
  140.  cmp ah,1
  141.  jne still
  142. .exit:
  143.  mcall -1
  144.  
  145.  
  146. check_boxes:
  147. ch1 check_box2 (5 shl 16)+15,(5 shl 16)+10,5, 0xffffff,0x8000,0xff,\
  148.  txt_160,0+ch_flag_middle
  149. ch2 check_box2 (5 shl 16)+15,(17 shl 16)+10,5, 0xffffff,0x8000,0xff,\
  150.  txt_159,0+ch_flag_middle
  151. ch3 check_box2 (5 shl 16)+15,(29 shl 16)+10,5, 0xffffff,0x8000,0xff,\
  152.  txt_158,0+ch_flag_middle
  153. check_boxes_end:
  154.  
  155. if lang eq it
  156.         txt_160 db 'Bloc Num',0
  157.         txt_159 db 'Bloc Maiusc',0
  158.         txt_158 db 'Bloc Scorr',0
  159. else
  160.         txt_160 db 'Num',0
  161.         txt_159 db 'Caps',0
  162.         txt_158 db 'Scroll',0
  163. end if
  164. head_f_i:
  165. head_f_l db 'Ñèñòåìíàÿ îøèáêà',0
  166.  
  167. system_dir_0 db '/sys/lib/'
  168. lib_name_0 db 'box_lib.obj',0
  169. err_msg_found_lib_0 db 'Íå íàéäåíà áèáëèîòåêà box_lib.obj',0
  170. err_msg_import_0 db 'Îøèáêà ïðè èìïîðòå áèáëèîòåêè box_lib',0
  171.  
  172. l_libs_start:
  173.  lib_0 l_libs lib_name_0, sys_path, library_path, system_dir_0,\
  174.  err_msg_found_lib_0,head_f_l,import_box_lib,err_msg_import_0,head_f_i
  175. l_libs_end:
  176.  
  177. align 4
  178. import_box_lib:
  179.  ;init dd sz_init
  180.  init_checkbox dd sz_init_checkbox
  181.  check_box_draw dd sz_check_box_draw
  182.  check_box_mouse dd sz_check_box_mouse
  183.  dd 0,0
  184.  ;sz_init db 'lib_init',0
  185.  sz_init_checkbox db 'init_checkbox2',0
  186.  sz_check_box_draw db 'check_box_draw2',0
  187.  sz_check_box_mouse db 'check_box_mouse2',0
  188.  
  189. ;mouse_dd dd 0x0
  190. sc system_colors
  191.  
  192. _end:
  193. align 32
  194.  rb 2048
  195. stacktop:
  196.  sys_path rb 1024
  197.  library_path rb 1024
  198. _memory:
  199.