Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;-----------------------------------------------------------------------------
  2. func define_3d_button ;///////////////////////////////////////////////////////
  3. ;-----------------------------------------------------------------------------
  4. ; ebx = <x,width>
  5. ; ecx = <y,height>
  6. ; esp+4*3 = id
  7. ; esp+4*2 = text
  8. ; esp+4*1 = text length
  9. ;-----------------------------------------------------------------------------
  10.         pushad
  11.         mov     edx,[esp+4*8+4+4*2]
  12.         or      edx,0x40000000
  13.         mcall   8
  14.         mov     eax,[esp+4*8+4*1]
  15.         add     eax,2
  16.         imul    eax,6
  17.         pushad
  18.         shr     ebx,16
  19.         shr     ecx,16
  20.         push    ebx ecx eax 15
  21.         call    draw_3d_panel
  22.         popad
  23.         shr     ecx,16
  24.         mov     bx,cx
  25.         add     ebx,7*65536+4
  26.         mcall   4,,[sc.work_text],[esp+4*8+4*2],[esp+4*8+4*1]
  27.         popad
  28.         ret     4*3
  29. endf
  30.  
  31. finddlg_handler:
  32.         cmp     al,1
  33.         je      .draw
  34.         cmp     al,2
  35.         je      .key
  36.         cmp     al,3
  37.         je      botdlg.button
  38.         ret
  39.  
  40.   .draw:
  41.         mov     ebx,[bot_ofs]
  42.         add     ebx,(1+3)*65536+6
  43.         mcall   4,,[sc.work_text],s_2find,s_2find.size+1
  44.         mov     ecx,[bot_ofs]
  45.         shl     ecx,16
  46.         add     ecx,(3+17)*65536+15
  47.  
  48.         push    ecx
  49.         cmp     [bot_dlg_mode2],0
  50.         je      @f
  51.         add     ebx,18
  52.         mcall   4,,[sc.work_text],s_2replace,s_2replace.size+1
  53.         mov     ecx,[esp]
  54.         add     ecx,18*65536
  55.     @@:
  56.  
  57.         mov     ebx,[p_info.client_box.width]
  58.         shl     ebx,16
  59.  
  60.         push    20003
  61.         cmp     [bot_dlg_mode2],0
  62.         jne     .draw.lp1
  63.         add     ebx,-(2+6*(s_2find.size+2))*65536+6*(s_2find.size+2)
  64.         push    s_2find s_2find.size
  65.         jmp     @f
  66.  
  67.   .draw.lp1:
  68.         add     ebx,-(2+6*(s_2replace.size+2))*65536+6*(s_2replace.size+2)
  69.         push    s_2replace s_2replace.size
  70.  
  71.     @@: call    define_3d_button
  72.         sub     ebx,(6*(s_2cancel.size+2)+3)*65536
  73.         mov     bx,6*(s_2cancel.size+2)
  74.         push    20001 s_2cancel s_2cancel.size
  75.         call    define_3d_button
  76.  
  77.         mov     ecx,[esp]
  78.  
  79.         mov     ebp,tb_find
  80.         mov     eax,[p_info.client_box.width]
  81.         sub     eax,6*(s_2find.size+2)+1
  82.         add     eax,6*(s_2find.size+2)*65536
  83.         mov     dword[tbox.x],eax
  84.         add     ecx,-18*65536+1
  85.         mov     dword[tbox.y],ecx
  86.         call    textbox.draw
  87.  
  88.         pop     ecx
  89.  
  90.         cmp     [bot_dlg_mode2],0
  91.         je      @f
  92.         mov     ebp,tb_replace
  93.         mov     eax,[p_info.client_box.width]
  94.         sub     eax,6*(s_2replace.size+2)+1
  95.         add     eax,6*(s_2replace.size+2)*65536
  96.         mov     dword[tbox.x],eax
  97.         inc     ecx
  98.         mov     dword[tbox.y],ecx
  99.         call    textbox.draw
  100.     @@:
  101.  
  102.         ret
  103.  
  104.   .key:
  105.         cmp     ebx,KEY_ESCAPE
  106.         je      btn.bot.cancel
  107.         cmp     ebx,KEY_RETURN
  108.         je      btn.bot.find
  109.         cmp     ebx,KEY_NUMRETURN
  110.         je      btn.bot.find
  111.         cmp     ebx,KEY_TAB
  112.         je      ..tab
  113.         call    textbox.key
  114.         ret
  115.  
  116.   ..tab:
  117.         cmp     [bot_dlg_mode2],0
  118.         je      @f
  119.         mov     eax,tb_replace
  120.         cmp     eax,[focused_tb]
  121.         jne     .key.lp1
  122.         mov     eax,tb_find
  123.   .key.lp1:
  124.         mov     [focused_tb],eax
  125.         call    .draw
  126.     @@: ret
  127.  
  128. osdlg_handler:
  129.         cmp     al,1
  130.         je      .draw
  131.         cmp     al,2
  132.         je      .key
  133.         cmp     al,3
  134.         je      botdlg.button
  135.         ret
  136.  
  137.   .draw:
  138.         mov     ebx,[bot_ofs]
  139.         add     ebx,(1+3)*65536+6
  140.         mcall   4,,[sc.work_text],s_2filename,s_2filename.size
  141.         mov     ebx,[p_info.client_box.width]
  142.         shl     ebx,16
  143.         mov     ecx,[bot_ofs]
  144.         shl     ecx,16
  145.         add     ecx,(2+18)*65536+15
  146.  
  147.         push    20002
  148.         cmp     [bot_dlg_mode2],0
  149.         jne     .draw.lp1
  150.         add     ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2)
  151.         push    s_2open s_2open.size
  152.         jmp     @f
  153.   .draw.lp1:
  154.         add     ebx,-(2+6*(s_2save.size+2))*65536+6*(s_2save.size+2)
  155.         push    s_2save s_2save.size
  156.  
  157.     @@: call    define_3d_button
  158.         sub     ebx,(6*(s_2cancel.size+2)+3)*65536
  159.         mov     bx,6*(s_2cancel.size+2)
  160.         push    20001 s_2cancel s_2cancel.size
  161.         call    define_3d_button
  162.  
  163.         mov     ebp,tb_opensave
  164.         mov     eax,[p_info.client_box.width]
  165.         sub     eax,6*(s_2filename.size+1)+1
  166.         add     eax,6*(s_2filename.size+1)*65536
  167.         mov     dword[tbox.x],eax
  168.         add     ecx,-18*65536+1
  169.         mov     dword[tbox.y],ecx
  170.         call    textbox.draw
  171.  
  172.         ret
  173.  
  174.   .key:
  175.         cmp     ebx,KEY_ESCAPE
  176.         je      btn.bot.cancel
  177.         cmp     ebx,KEY_RETURN
  178.         je      btn.bot.opensave
  179.         cmp     ebx,KEY_NUMRETURN
  180.         je      btn.bot.opensave
  181.         call    textbox.key
  182.         ret
  183.  
  184. gotodlg_handler:
  185.         cmp     al,1
  186.         je      .draw
  187.         cmp     al,2
  188.         je      .key
  189.         cmp     al,3
  190.         je      botdlg.button
  191.         ret
  192.  
  193.   .draw:
  194.         mov     ebx,[bot_ofs]
  195.         add     ebx,(1+3)*65536+6
  196.         mcall   4,,[sc.work_text],s_2filename,s_2filename.size
  197.         mov     ebx,[p_info.box.width]
  198.         shl     ebx,16
  199.         mov     ecx,[bot_ofs]
  200.         shl     ecx,16
  201.         add     ecx,(2+18)*65536+15
  202.  
  203.         push    20002
  204.         cmp     [bot_dlg_mode2],0
  205.         jne     .draw.lp1
  206.         add     ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2)
  207.         push    s_2open s_2open.size
  208.         jmp     @f
  209.   .draw.lp1:
  210.         add     ebx,-(2+6*(s_2save.size+2))*65536+6*(s_2save.size+2)
  211.         push    s_2save s_2save.size
  212.  
  213.     @@: call    define_3d_button
  214.         sub     ebx,(6*(s_2cancel.size+2)+3)*65536
  215.         mov     bx,6*(s_2cancel.size+2)
  216.         push    20001 s_2cancel s_2cancel.size
  217.         call    define_3d_button
  218.  
  219.         mov     ebp,tb_opensave
  220.         mov     eax,[p_info.box.width]
  221.         sub     eax,6*(s_2filename.size+3)
  222.         add     eax,6*(s_2filename.size+2)*65536
  223.         mov     dword[tbox.x],eax
  224.         add     ecx,-18*65536+1
  225.         mov     dword[tbox.y],ecx
  226.         call    textbox.draw
  227.  
  228.         ret
  229.  
  230.   .key:
  231.         cmp     ebx,KEY_ESCAPE
  232.         je      btn.bot.cancel
  233.         cmp     ebx,KEY_RETURN
  234.         je      btn.bot.opensave
  235.         cmp     ebx,KEY_NUMRETURN
  236.         je      btn.bot.opensave
  237.         call    textbox.key
  238.         ret
  239.  
  240. botdlg.button:
  241.         mov     esi,accel_table2_botdlg
  242.   .acc: cmp     ebx,[esi]
  243.         jne     @f
  244.         call    dword[esi+4]
  245.         ret
  246.     @@: add     esi,8
  247.         cmp     byte[esi],0
  248.         jne     .acc
  249.         ret
  250.  
  251.   btn.bot.cancel:
  252.         xor     eax,eax
  253.         mov     [bot_mode],al
  254.         mov     [bot_dlg_height],eax
  255.         call    drawwindow
  256.         ret
  257.  
  258.   btn.bot.opensave:
  259.         cmp     [bot_dlg_mode2],0
  260.         je      .lp1
  261.         call    save_file
  262.         jnc     @f
  263.         jmp     .lp2
  264.   .lp1: call    btn.load_file
  265.         jnc     @f
  266.   .lp2:
  267.         ret
  268.     @@: call    update_caption
  269.         xor     eax,eax
  270.         mov     [bot_mode],al
  271.         mov     [bot_dlg_height],eax
  272.         call    drawwindow
  273.         ret
  274.  
  275.   btn.bot.find:
  276.         movzx   ecx,[tb_find.length]
  277.         mov     [s_search.size],ecx
  278.         mov     esi,tb_find.text
  279.         mov     edi,s_search
  280.         cld
  281.         rep     movsb
  282.  
  283.         cmp     [bot_dlg_mode2],0
  284.         je      @f
  285.         call    search
  286.         jnc     .found
  287.         call    check_inv_all
  288.         ret
  289.  
  290.   .found:
  291. ;---------------------------------------
  292.         push    [copy_size] [copy_count]
  293.  
  294.         mov     esi,AREA_CBUF
  295.         mov     edi,AREA_CBUF-304
  296.         mov     ecx,300/4
  297.         rep     movsd
  298.  
  299.         movzx   eax,[tb_replace.length]
  300.         mov     esi,tb_replace.text
  301.         mov     edi,AREA_CBUF
  302.         stosd
  303.         mov     ecx,eax
  304.         jecxz   .lp1
  305.         rep     movsb
  306.   .lp1: add     eax,4
  307.         mov     [copy_size],eax
  308.         mov     [copy_count],1
  309.  
  310.         push    [sel.x]
  311.         call    init_sel_vars
  312.         call    key.ctrl_v
  313.         pop     [sel.x]
  314.  
  315.         mov     esi,AREA_CBUF-304
  316.         mov     edi,AREA_CBUF
  317.         mov     ecx,300/4
  318.         rep     movsd
  319.  
  320.         pop     [copy_count] [copy_size]
  321. ;---------------------------------------
  322.  
  323.         call    check_inv_all
  324.         ret
  325.     @@: xor     eax,eax
  326.         mov     [bot_mode],al
  327.         mov     [bot_dlg_height],eax
  328.         call    btn.search
  329.         call    drawwindow
  330.         ret
  331.