Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. ;POP_WIDTH   = (popup_text.max_title+popup_text.max_accel+6)*6
  3. POP_IHEIGHT = 16
  4. POP_SHEIGHT = 3
  5. ;POP_HEIGHT  = popup_text.cnt_item*POP_IHEIGHT+popup_text.cnt_sep*4+4
  6.  
  7. popup_thread_start:
  8.         mov     [popup_active],1
  9.         mov     [pi_cur],0
  10.         mov     ebp,[esp]
  11.         mcall   14
  12.         movzx   ebx,ax
  13.         shr     eax,16
  14.         movzx   ecx,[ebp+POPUP.x]
  15.         add     cx,[ebp+POPUP.width]
  16.         cmp     ecx,eax
  17.         jle     @f
  18.         mov     cx,[ebp+POPUP.width]
  19.         sub     [ebp+POPUP.x],cx
  20.     @@: movzx   ecx,[ebp+POPUP.y]
  21.         add     cx,[ebp+POPUP.height]
  22.         cmp     ecx,ebx
  23.         jle     @f
  24.         mov     cx,[ebp+POPUP.height]
  25.         sub     [ebp+POPUP.y],cx
  26.     @@: mcall   40,01100111b            ; ipc mouse button key redraw
  27.         cmp     [mi_cur],0
  28.         jl      .2
  29.         sub     esp,32-16
  30.         push    0 0 8 0
  31.         mcall   60,1,esp,32
  32.   .2:   call    draw_popup_wnd
  33.  
  34.   still_popup:
  35.         cmp     [main_closed],1
  36.         je      close_popup
  37.         mcall   10
  38.         cmp     eax,1
  39.         je      popup_thread_start.2
  40.         cmp     eax,2
  41.         je      key_popup
  42.         cmp     eax,3
  43.         je      button_popup
  44.         cmp     eax,6
  45.         je      mouse_popup
  46.         cmp     eax,7
  47.         jne     still_popup
  48.  
  49.         mov     ebp,[POPUP_STACK]
  50.         mov     dword[POPUP_STACK-32+4],8
  51.         movzx   ebx,[ebp+POPUP.x]
  52.         movzx   ecx,[ebp+POPUP.y]
  53.         movzx   edx,[ebp+POPUP.width]
  54.         movzx   esi,[ebp+POPUP.height]
  55.         mcall   67
  56.         jmp     still_popup
  57.  
  58.   mouse_popup:
  59.         mov     ecx,mst2
  60.         call    get_mouse_event
  61.         cmp     al,MEV_LDOWN
  62.         je      check_popup_click
  63.         cmp     al,MEV_MOVE
  64.         je      check_popup_move
  65.  
  66.         mcall   9,p_info2,-1
  67.         cmp     ax,[p_info2.window_stack_position]
  68.         jne     close_popup
  69.  
  70.         jmp     still_popup
  71.  
  72.   check_popup_click:
  73.         mov     eax,[pi_cur]
  74.         or      al,al
  75.         js      close_popup
  76.         jz      still_popup
  77.         mov     ebx,[ebp+POPUP.actions]
  78.         mov     [just_from_popup],1
  79.         call    dword[ebx+eax*4-4]
  80.         inc     [just_from_popup]
  81.         jmp     close_popup
  82.  
  83.   check_popup_move:
  84.         mov     eax,[pi_cur]
  85.         call    get_active_popup_item
  86.         cmp     eax,[pi_cur]
  87.         je      still_popup
  88.         call    draw_popup_wnd
  89.         jmp     still_popup
  90.  
  91.   key_popup:
  92.         mcall   ;2
  93.         cmp     ah,27
  94.         jne     still_popup
  95.  
  96.   button_popup:
  97.         mcall   17
  98.  
  99.   close_popup:
  100.         mcall   18,3,[p_info.PID]
  101.         mov     [popup_active],0
  102.         mov     [mi_cur],0
  103.         mcall   -1
  104.  
  105. func draw_popup_wnd
  106.         mcall   12,1
  107.  
  108.         mov     ebx,dword[ebp+POPUP.x-2]
  109.         mov     bx,[ebp+POPUP.width]
  110.         mov     ecx,dword[ebp+POPUP.y-2]
  111.         mov     cx,[ebp+POPUP.height]
  112.         mcall   0,,,0x01000000,0x01000000
  113.  
  114.         movzx   ebx,bx
  115.         movzx   ecx,cx
  116.         pushd   0 0 ebx ecx
  117.         call    draw_3d_panel
  118.  
  119.         mov     [pi_sel],0
  120.         mov     eax,4
  121.         mpack   ebx,3*6,3
  122.         mov     ecx,[sc.work_text]
  123.         mov     edx,[ebp+POPUP.data]
  124.     @@: inc     [pi_sel]
  125.         inc     edx
  126.         movzx   esi,byte[edx-1]
  127.         cmp     byte[edx],'-'
  128.         jne     .lp1
  129.         pushad
  130.         mov     ecx,ebx
  131.         shl     ecx,16
  132.         mov     cx,bx
  133.         movzx   ebx,[ebp+POPUP.width]
  134.         add     ebx,0x00010000-1
  135.         add     ecx,0x00010001
  136.         mcall   38,,,[cl_3d_inset]
  137.         add     ecx,0x00010001
  138.         mcall   ,,,[cl_3d_outset]
  139.         popad
  140.         add     ebx,4
  141.         jmp     .lp2
  142.   .lp1: mov     edi,[pi_sel]
  143.         cmp     edi,[pi_cur]
  144.         jne     .lp3
  145.         test    byte[ebp+edi-1],0x01
  146.         jz      .lp3
  147.         pushad
  148.         movzx   ecx,bx
  149.         shl     ecx,16
  150.         mov     cl,POP_IHEIGHT-1
  151.         movzx   ebx,[ebp+POPUP.width]
  152.         add     ebx,0x00010000-1
  153.         mcall   13,,,[cl_3d_pushed]
  154.         rol     ecx,16
  155.         mov     ax,cx
  156.         rol     ecx,16
  157.         mov     cx,ax
  158.         mcall   38,,,[cl_3d_inset]
  159.         add     ecx,(POP_IHEIGHT-1)*65536+POP_IHEIGHT-1
  160.         mcall   ,,,[cl_3d_outset]
  161.         popad
  162.   .lp3: add     ebx,(POP_IHEIGHT-7)/2
  163.  
  164.         pushad
  165.         test    byte[ebp+edi-1],0x02
  166.         jz      .lp8
  167.         movzx   ecx,bx
  168.         shr     ebx,16
  169.         add     ebx,-11
  170.         add     ecx,2
  171.         mov     edx,[sc.work_text]
  172.         call    draw_check
  173.   .lp8: popad
  174.  
  175.         mov     ecx,[sc.work_text]
  176.         test    byte[ebp+edi-1],0x01
  177.         jnz     .lp5
  178.         add     ebx,0x00010001
  179.         mov     ecx,[cl_3d_outset]
  180.         mcall
  181.         sub     ebx,0x00010001
  182.         mov     ecx,[cl_3d_inset]
  183.   .lp5: mcall
  184.         push    ebx
  185.         add     edx,esi
  186.         inc     edx
  187.         movzx   esi,byte[edx-1]
  188.         add     ebx,[ebp+POPUP.acc_ofs]
  189.         cmp     edi,[pi_cur]
  190.         je      .lp4
  191.         mov     ecx,[cl_3d_inset]
  192.   .lp4: test    byte[ebp+edi-1],0x01
  193.         jnz     .lp6
  194.         add     ebx,0x00010001
  195.         mov     ecx,[cl_3d_outset]
  196.         mcall
  197.         sub     ebx,0x00010001
  198.         mov     ecx,[cl_3d_inset]
  199.   .lp6: mcall
  200.         pop     ebx
  201.         add     ebx,POP_IHEIGHT-(POP_IHEIGHT-7)/2
  202.   .lp2: add     edx,esi
  203.         cmp     byte[edx],0
  204.         jne     @b
  205.   .exit:
  206.         mcall   12,2
  207.         ret
  208. endf
  209.  
  210. func setup_main_menu_popup
  211.         mov     ebx,[p_info.box.left]
  212.         add     ebx,[p_info.client_box.left]
  213.     @@: dec     ecx
  214.         jz      @f
  215.         add     edx,8+1
  216.         movzx   esi,byte[edx-1]
  217.         add     edx,esi
  218.         jmp     @b
  219.     @@: movzx   ecx,word[edx+2]
  220.         add     ebx,ecx
  221.  
  222.         mov     [eax+POPUP.x],bx
  223.         mov     ebx,[p_info.box.top]
  224.         add     ebx,[p_info.client_box.top]
  225.         add     ebx,ATOPH-1
  226.         mov     [eax+POPUP.y],bx
  227.         mov     [POPUP_STACK],eax
  228.         ret
  229. endf
  230.  
  231. onshow:
  232.  
  233.   .file:
  234.         or      byte[mm.File+3],0x01
  235.         cmp     [f_info.length],0
  236.         jne     @f
  237.         and     byte[mm.File+3],0xFE
  238.     @@: ret
  239.  
  240.   .edit:
  241.         or      byte[mm.Edit+2],0x01
  242.         cmp     [copy_size],0
  243.         jne     @f
  244.         and     byte[mm.Edit+2],0xFE
  245.     @@: or      dword[mm.Edit+0],0x01000101
  246.         cmp     [sel.selected],0
  247.         jne     @f
  248.         and     dword[mm.Edit+0],0xFEFFFEFE
  249.     @@: ret
  250.  
  251.   .search:
  252.         mov     byte[mm.Search+0],0
  253.         ret
  254.   .run:
  255.         ret
  256.   .recode:
  257.         ret
  258.   .options:
  259.         ;mov     word[mm.Options+0],0
  260.         mov     byte[mm.Options+5],0
  261.         or      byte[mm.Options+2],0x02
  262.         test    [options],OPTS_SECURESEL
  263.         jnz     @f
  264.         and     byte[mm.Options+2],0xFD
  265.     @@: or      byte[mm.Options+3],0x02
  266.         test    [options],OPTS_AUTOBRACES
  267.         jnz     @f
  268.         and     byte[mm.Options+3],0xFD
  269.     @@: or      byte[mm.Options+4],0x02
  270.         test    [options],OPTS_AUTOINDENT
  271.         jnz     @f
  272.         and     byte[mm.Options+4],0xFD
  273.     @@: or      byte[mm.Options+6],0x02
  274.         test    [options],OPTS_OPTIMSAVE
  275.         jnz     @f
  276.         and     byte[mm.Options+6],0xFD
  277.     @@: or      byte[mm.Options+8],0x02
  278.         test    [options],OPTS_LINENUMS
  279.         jnz     @f
  280.         and     byte[mm.Options+8],0xFD
  281.     @@: ret
  282.  
  283. pi_sel   dd ?
  284. pi_cur   dd ?
  285. p_pos    dd ?
  286. popup_active db 0
  287.