Subversion Repositories Kolibri OS

Rev

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

  1. ;---------------------------------------------------------------------
  2. key_menu:
  3.     mcall 2
  4.     cmp  [extended_key],1
  5.     je   .extended_key
  6.     test al, al
  7.     jnz  .end_1
  8.     cmp  ah, 0xE0
  9.     jne  @f
  10.     mov  [extended_key],1
  11. .end_1:
  12.     ret
  13. @@:
  14.     cmp  ah,72
  15.     je  menu_key_72.1
  16.     cmp  ah,80
  17.     je  menu_key_80.1
  18.     cmp  ah,28
  19.     je  menu_key_28.1
  20. .end:
  21.     cmp  ah,208
  22.     je  .end_1
  23.     cmp  ah,200
  24.     je  .end_1
  25.     cmp  ah,156
  26.     je  .end_1
  27.     cmp  ah,184
  28.     je  .end_5
  29.     cmp  ah,187
  30.     je  .end_1
  31.     cmp  ah,188
  32.     je  .end_1
  33.     cmp  ah,199
  34.     je  .end_1
  35.     cmp  ah,207
  36.     je  .end_1
  37.     cmp  ah,201
  38.     je  .end_1
  39.     cmp  ah,209
  40.     je  .end_1
  41.     cmp  ah,42  ; NumLock ON
  42.     je  .end_1
  43.     cmp  ah,170  ; NumLock ON
  44.     je  .end_1
  45.     cmp  ah,210
  46.     je  .end_1
  47.     cmp  ah,211
  48.     je  .end_1
  49.     cmp  ah,56
  50.     je  .end_4
  51.     cmp  ah,59
  52.     je  .end_2
  53.     cmp  ah,60
  54.     je  .end_3
  55. .for_all:
  56.     mov [close_menu],1
  57.     ret
  58.  
  59. .end_2:
  60.     cmp  [alt_flag],0
  61.     je   .for_all
  62.     cmp  [select_panel_counter],0
  63.     je  .end_1
  64.     mov [close_menu],2
  65.     ret
  66. .end_3:
  67.     cmp  [alt_flag],0
  68.     je   .for_all
  69.     cmp  [select_panel_counter],0
  70.     jne  .end_1
  71.     mov [close_menu],2
  72.     ret
  73. .end_4:
  74.     cmp  [alt_flag],1
  75.     je   .end_1
  76.     mov  [alt_flag],1
  77.     jmp  @f
  78. .end_5:
  79.     cmp  [alt_flag],0
  80.     je   .end_1
  81.     mov  [alt_flag],0
  82. @@:
  83.     call erase_fbutton
  84.     call draw_fbutton
  85.     ret
  86. ;---------------------------------------------------------------------
  87. .extended_key:
  88.     mov  [extended_key],0
  89. menu_key_80:
  90.     cmp  ah,80  ; arrow down
  91.     jne  menu_key_72
  92. .1:
  93.     mov  eax,[retrieved_devices_table_counter]
  94.     dec  eax
  95.     cmp  eax,[start_draw_menu_cursor_line]
  96.     je   @f
  97.     inc  [start_draw_menu_cursor_line]
  98. @@:
  99.     ret
  100. ;---------------------------------------------------------------------
  101. menu_key_72:
  102.     cmp  ah,72  ;arrow up
  103.     jne  menu_key_71
  104. .1:
  105.     cmp  [start_draw_menu_cursor_line],0
  106.     je   @f
  107.     dec  [start_draw_menu_cursor_line]
  108. @@:
  109.     ret
  110. ;---------------------------------------------------------------------
  111. menu_key_71:
  112.     cmp  ah,71    ;Home
  113.     je   @f
  114.     cmp  ah,73    ;PageUp
  115.     jne  menu_key_79
  116. @@:
  117.     mov   [start_draw_menu_cursor_line],0
  118.     ret
  119. ;---------------------------------------------------------------------
  120. menu_key_79:
  121.     cmp  ah,79    ; End
  122.     je   @f
  123.     cmp  ah,81    ; PageDown
  124.     jne  menu_key_82
  125. @@:
  126.     mov  eax,[retrieved_devices_table_counter]
  127.     dec  eax
  128.     mov   [start_draw_menu_cursor_line],eax
  129.     ret
  130. ;---------------------------------------------------------------------
  131. menu_key_82:
  132.     cmp  ah,82  ; Insert
  133.     jne  menu_key_83
  134.     mov  esi,[start_draw_menu_cursor_line]
  135.     imul esi,10
  136.     add  esi,retrieved_devices_table
  137.     inc  esi
  138.     cmp  [esi],word 'cd'
  139.     jne  @f
  140.     xor  ecx,ecx
  141.     mov  cl,[esi+2]
  142.     sub  ecx,0x30
  143.     mcall 24,5
  144. @@:
  145.     ret
  146. ;---------------------------------------------------------------------
  147. menu_key_83:
  148.     cmp  ah,83  ; Delete
  149.     jne  menu_key_28
  150.     mov  esi,[start_draw_menu_cursor_line]
  151.     imul esi,10
  152.     add  esi,retrieved_devices_table
  153.     inc  esi
  154.     cmp  [esi],word 'cd'
  155.     jne  @f
  156.     xor  ecx,ecx
  157.     mov  cl,[esi+2]
  158.     sub  ecx,0x30
  159.     mcall 24,4
  160. @@:
  161.     ret
  162. ;---------------------------------------------------------------------
  163. menu_key_28:
  164.     cmp  ah,28 ; Enter
  165.     jne  menu_key_end
  166. .1:
  167.     mov [press_enter_menu],1
  168.     ret
  169. menu_key_end:
  170.     jmp  key_menu.end
  171. ;---------------------------------------------------------------------
  172. key_menu_left:
  173.     mov  [close_menu],0
  174.     mov [press_enter_menu],0
  175.     call key_menu
  176.     cmp  [press_enter_menu],1
  177.     je   .press_enter_menu
  178.     cmp  [close_menu],0
  179.     je   draw_left_select_disk_menu.red
  180. .1:
  181. ;    mov   [left_panel_clear_all],1
  182.     call draw_left_panel
  183. ;    mov   [right_panel_clear_all],1
  184.     call draw_right_panel
  185.     cmp  [alt_flag],0
  186.     je   still
  187.     cmp  [close_menu],2
  188.     je   draw_right_select_disk_menu
  189.     jmp  still
  190. .press_enter_menu:
  191.     mov  esi,[start_draw_menu_cursor_line]
  192.     imul esi,10
  193.     add  esi,retrieved_devices_table
  194.     inc  esi
  195.     call copy_folder_name
  196.     mov  [left_start_draw_cursor_line],0
  197.     call proc_read_folder
  198.     jmp  still
  199. ;---------------------------------------------------------------------
  200. key_menu_right:
  201.     mov  [close_menu],0
  202.     mov [press_enter_menu],0
  203.     call key_menu
  204.     cmp  [press_enter_menu],1
  205.     je   .press_enter_menu
  206.     cmp  [close_menu],0
  207.     je   draw_right_select_disk_menu.red
  208. .1:
  209. ;    mov   [left_panel_clear_all],1
  210.     call draw_left_panel
  211. ;    mov   [right_panel_clear_all],1
  212.     call draw_right_panel
  213.     cmp  [alt_flag],0
  214.     je   still
  215.     cmp  [close_menu],2
  216.     je   draw_left_select_disk_menu
  217.     jmp  still
  218. .press_enter_menu:
  219.     mov  esi,[start_draw_menu_cursor_line]
  220.     imul esi,10
  221.     add  esi,retrieved_devices_table
  222.     inc  esi
  223.     call copy_folder_name_1
  224.     mov  [right_start_draw_cursor_line],0
  225.     call proc_read_folder_1
  226.     jmp  still
  227. ;---------------------------------------------------------------------
  228. draw_left_select_disk_menu:
  229.     mov  [select_panel_counter],0
  230.     call  draw_left_panel
  231.     call  draw_right_panel
  232.     mov  [start_draw_menu_cursor_line],0
  233. .red:
  234.     call  draw_left_menu
  235. .still:
  236.     mcall 10
  237.     cmp  eax,1
  238.     je   red
  239.     cmp  eax,2
  240.     je   key_menu_left
  241.     cmp  eax,3
  242.     je   @f
  243.     cmp   eax,6
  244.     je    mouse_menu_left
  245.     jmp  .still
  246. @@:
  247.     call draw_left_panel
  248.     jmp  button
  249. ;---------------------------------------------------------------------
  250. draw_right_select_disk_menu:
  251.     mov  [select_panel_counter],1
  252.     call  draw_left_panel
  253.     call  draw_right_panel
  254.     mov  [start_draw_menu_cursor_line],0
  255. .red:
  256.     call  draw_right_menu
  257. .still:
  258.     mcall 10
  259.     cmp  eax,1
  260.     je   red
  261.     cmp  eax,2
  262.     je   key_menu_right
  263.     cmp  eax,3
  264.     je   @f
  265.     cmp   eax,6
  266.     je    mouse_menu_right
  267.     jmp  .still
  268. @@:
  269.     call draw_right_panel
  270.     jmp  button
  271. ;---------------------------------------------------------------------
  272. draw_left_menu:
  273.     mov  ebx,[left_panel_x]
  274.     mov  bx,60
  275.     mov  ecx,[left_panel_y]
  276.     mov  eax,[retrieved_devices_table_counter]
  277.     mov  cx,ax
  278.     imul cx,10
  279.     mov  edx,0xffffcc
  280.     mov  eax,13
  281.     int  0x40
  282.     call draw_menu_Selection
  283.     call draw_menu_data
  284.     ret
  285. ;---------------------------------------------------------------------
  286. draw_right_menu:
  287.     mov  ebx,[right_panel_x]
  288.     mov  bx,60
  289.     mov  ecx,[right_panel_y]
  290.     mov  eax,[retrieved_devices_table_counter]
  291.     mov  cx,ax
  292.     imul cx,10
  293.     mov  edx,0xffffcc
  294.     mov  eax,13
  295.     int  0x40
  296.     call draw_menu_Selection
  297.     call draw_menu_data
  298.     ret
  299. ;---------------------------------------------------------------------
  300. draw_menu_data:
  301.     mov  edx,retrieved_devices_table
  302.     shr  ecx,16
  303.     mov  bx,cx
  304.     mov  ebp,0
  305. .start:
  306.     mcall 4, ,0x80000000
  307.     add   ebx,10
  308.     add   edx,10
  309.     inc   ebp
  310.     cmp   ebp,[retrieved_devices_table_counter]
  311.     jne   .start
  312.     ret
  313. ;---------------------------------------------------------------------
  314. draw_menu_Selection:
  315.     push ebx ecx
  316.     mov  eax,[start_draw_menu_cursor_line]
  317.     imul eax,10
  318.     shl  eax,16
  319.     add  ecx,eax
  320.     mov  cx,10
  321.     mov  edx,0xbbffbb
  322.     mov  eax,13
  323.     int  0x40
  324.     pop  ecx ebx
  325.     ret
  326. ;---------------------------------------------------------------------
  327. mouse_menu_left:
  328.     mcall 37,2
  329.     mov  [mouse_keys],eax
  330.     mcall 37,1
  331.     mov  [mouse_position],eax
  332.     test eax,0x80000000
  333.     jnz   draw_left_select_disk_menu.still
  334.     test eax,0x8000
  335.     jnz   draw_left_select_disk_menu.still
  336.     mov   ebx,eax
  337.     shr   ebx,16
  338.     shl   eax,16
  339.     shr   eax,16
  340.     cmp   ebx,[window_width]
  341.     ja    draw_left_select_disk_menu.still
  342.     cmp   eax,[window_high]
  343.     ja    draw_left_select_disk_menu.still
  344.     xor   ecx,ecx
  345.     mov   cx,[left_panel_y.start_y]
  346.     cmp   ax,cx
  347.     jbe    .close
  348.     mov   edx,[retrieved_devices_table_counter]
  349.     imul  edx,10
  350.     add   cx,dx
  351.     cmp   ax,cx
  352.     jae    .close
  353.     mov   cx,[left_panel_x.start_x]
  354.     cmp   bx,cx
  355.     jbe    .close
  356.     add   cx,60
  357.     cmp   bx,cx
  358.     jae    .close
  359.     sub   ax,[left_panel_y.start_y]
  360.     mov   ebx,10
  361.     xor   edx,edx
  362.     div   ebx
  363.     mov   [start_draw_menu_cursor_line],eax
  364.     cmp   [mouse_keys],0
  365.     je    draw_left_select_disk_menu.red
  366.     jmp   key_menu_left.press_enter_menu
  367. .close:
  368.     cmp   [mouse_keys],0
  369.     je    draw_left_select_disk_menu.still
  370. ;    mov   [left_panel_clear_all],1
  371.     call  draw_left_panel
  372.     jmp   still
  373. ;---------------------------------------------------------------------
  374. mouse_menu_right:
  375.     mcall 37,2
  376.     mov  [mouse_keys],eax
  377.     mcall 37,1
  378.     mov  [mouse_position],eax
  379.     test eax,0x80000000
  380.     jnz   draw_right_select_disk_menu.still
  381.     test eax,0x8000
  382.     jnz   draw_right_select_disk_menu.still
  383.     mov   ebx,eax
  384.     shr   ebx,16
  385.     shl   eax,16
  386.     shr   eax,16
  387.     cmp   ebx,[window_width]
  388.     ja    draw_right_select_disk_menu.still
  389.     cmp   eax,[window_high]
  390.     ja    draw_right_select_disk_menu.still
  391.     xor   ecx,ecx
  392.     mov   cx,[right_panel_y.start_y]
  393.     cmp   ax,cx
  394.     jbe    .close
  395.     mov   edx,[retrieved_devices_table_counter]
  396.     imul  edx,10
  397.     add   cx,dx
  398.     cmp   ax,cx
  399.     jae    .close
  400.     mov   cx,[right_panel_x.start_x]
  401.     cmp   bx,cx
  402.     jbe    .close
  403.     add   cx,60
  404.     cmp   bx,cx
  405.     jae    .close
  406.     sub   ax,[right_panel_y.start_y]
  407.     mov   ebx,10
  408.     xor   edx,edx
  409.     div   ebx
  410.     mov   [start_draw_menu_cursor_line],eax
  411.     cmp   [mouse_keys],0
  412.     je    draw_right_select_disk_menu.red
  413.     jmp   key_menu_right.press_enter_menu
  414. .close:
  415.     cmp   [mouse_keys],0
  416.     je    draw_right_select_disk_menu.still
  417. ;    mov   [right_panel_clear_all],1
  418.     call  draw_right_panel
  419.     jmp   still
  420. ;---------------------------------------------------------------------