Subversion Repositories Kolibri OS

Rev

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

  1. ;---------------------------------------------------------------------
  2. k_sort_directory:
  3.         test    dword [status],16
  4.         jnz     still
  5.         or      dword [status],16
  6.  
  7.         call    get_memory_for_tread_stack
  8.         mov     [thread_stack_5],eax
  9.         mcall   51, 1, thread5  ;, thread_stack_5
  10.         jmp     still
  11. ;---------------------------------------------------------------------
  12. thread5:                                ; start of bgrd thread
  13.         mcall   9, procinfo_threads, -1
  14.         mov     eax,[ebx+30]
  15.         mov     [PID5],eax
  16.         mcall   40, 0x27
  17.         mov     eax,[sort_type]
  18.         cmp     [sort_type],dword 0
  19.         jne     @f
  20.         mov     [option_group2],sort0
  21.         jmp     .thread5
  22. @@:
  23.         cmp     [sort_type],dword 2
  24.         jne     @f
  25.         mov     [option_group2],sort2
  26.         jmp     .thread5
  27. @@:
  28.         cmp     [sort_type],dword 4
  29.         jne     @f
  30.         mov     [option_group2],sort4
  31.         jmp     .thread5
  32. @@:
  33. ;       cmp     [sort_type],dword 6
  34. ;       jne     @f
  35.         mov     [option_group2],sort6
  36. ;       jmp     .thread5
  37. ;@@:
  38. .thread5:
  39.         mov     [sort_type_old],eax
  40.         mov     eax,[option_group2]
  41.         mov     [option_group2_old],eax
  42.        
  43. .red:
  44.         call    .draw_window
  45.  
  46. .still:
  47.  
  48.         mov     eax,10          ; wait here for event
  49.         mcall
  50.  
  51.         cmp     eax,1                   ; redraw request ?
  52.         je      .red
  53.         cmp     eax,2                   ; key in buffer ?
  54.         je      .key
  55.         cmp     eax,3                   ; button in buffer ?
  56.         je      .button
  57.         cmp     eax,6   ; mouse in buffer ?
  58.         je      .mouse
  59.         jmp     .still
  60.  
  61. .mouse:
  62.         push    dword option_boxes_sort
  63.         call    [option_box_mouse]
  64.  
  65.         cmp     [option_group2],sort0
  66.         jne     @f
  67.         mov     [sort_type],dword 0
  68.         jmp     .still
  69. @@:
  70.         cmp     [option_group2],sort2
  71.         jne     @f
  72.         mov      [sort_type],dword 2
  73.         jmp     .still
  74. @@:
  75.         cmp     [option_group2],sort4
  76.         jne     @f
  77.         mov     [sort_type],dword 4
  78.         jmp     .still
  79. @@:
  80.         cmp     [option_group2],sort6
  81.         jne     @f
  82.         mov     [sort_type],dword 6
  83.         jmp     .still
  84.  
  85. .key:
  86.         mcall
  87.         cmp     ah,27
  88.         je      .close
  89.         cmp     ah,13
  90.         je      .kok
  91.         cmp     ah,177 ;down
  92.         je      .fdn
  93.         cmp     ah,178 ;up
  94.         jne     .still
  95.         cmp     [sort_type],0
  96.         je      .still
  97.        
  98.         sub     [sort_type],2
  99.         jmp     .flagcont
  100.  
  101. .fdn:
  102.         cmp     [sort_type],6
  103.         je      .still
  104.         add     [sort_type],2
  105.        
  106. .flagcont:
  107.         cmp     [sort_type],dword 0
  108.         jne     @f
  109.         mov     [option_group2],sort0
  110.         call    .draw_opt_boxes
  111.         jmp     .still
  112. @@:
  113.         cmp     [sort_type],dword 2
  114.         jne     @f
  115.         mov     [option_group2],sort2
  116.         call    .draw_opt_boxes
  117.         jmp     .still
  118. @@:
  119.         cmp     [sort_type],dword 4
  120.         jne     @f
  121.         mov     [option_group2],sort4
  122.         call    .draw_opt_boxes
  123.         jmp     .still
  124. @@:
  125.         cmp     [sort_type],dword 6
  126.         jne     .still  ;@f
  127.         mov     [option_group2],sort6
  128.         call    .draw_opt_boxes
  129.         jmp     .still
  130.  
  131. .button:                         ; button
  132.         mov     eax,17          ; get id
  133.         mcall
  134.  
  135.         cmp     ah,1                    ; button id=1 ?
  136.         jne     .noclose
  137. .close:
  138.         mov     eax,[sort_type_old]
  139.         mov     [sort_type],eax
  140.         mov     eax,[option_group2_old]
  141.         mov     [option_group2],eax
  142. .close_1:
  143.         xor     dword [status],16
  144.         xor     eax,eax
  145.         mov     [PID5],eax
  146.  
  147.         mcall   68,13,[thread_stack_5]
  148.         mov     eax,-1          ; close this program
  149.         mcall
  150. .noclose:
  151. .kok:
  152.         mov     eax,[load_directory_pointer]
  153.         cmp     [eax+4],dword 0
  154.         je      .close_1
  155.         call    load_directory.copy_dir_path
  156.         call    load_directory.sort
  157.         mov     [sort_directory_flag],byte 1
  158.         jmp     .close_1
  159.  
  160. ;        *********************************************
  161. ;        *******        WINDOW DEFINITIONS AND DRAW ********
  162. ;        *********************************************
  163.  
  164.  
  165. .draw_window:
  166.         mcall   12,1
  167.  
  168.                                          ; DRAW WINDOW
  169.         xor     eax,eax                  ; function 0 : define and draw window
  170.         mov     ebx,100*65536+300        ; [x start] *65536 + [x size]
  171.         mov     ecx,100*65536+110        ; [y start] *65536 + [y size]
  172.         mov     edx,0x03909090           ; color of work area RRGGBB,8->color gl
  173.         mcall
  174.  
  175.         mov     eax,8
  176.         mov     ebx,120*65536+40
  177.         mov     ecx,50*65536+20
  178.         mov     edx,4
  179.         mov     esi,0xdddddd
  180.         mcall
  181.  
  182.                                          ; WINDOW LABEL
  183.         mcall   71,1, labelt5
  184.        
  185.         mov     eax,4                    ; function 4 : write text to window
  186.         mov     ebx,46*65536+28          ; [x start] *65536 + [y start]
  187.         mov     ecx,0xffffff
  188.         mov     edx, sorttext
  189.         mov     esi, sorttext.size
  190.         mcall
  191.         mov     ebx,135*65536+57
  192.         mov     edx, ok_btn
  193.         mov     esi, ok_btn.size ;2
  194.         mov     ecx,0
  195.         mcall
  196.  
  197.         call    .draw_opt_boxes
  198. ;       mcall   47,0x80000,[PID5],<200, 5>,0xffffff
  199.         mcall   12,2
  200.  
  201.         ret
  202. ;---------------------------------------------------------------------
  203. .draw_opt_boxes:
  204.         push    dword option_boxes_sort
  205.         call    [option_box_draw]
  206.         ret