Subversion Repositories Kolibri OS

Rev

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

  1. if lang eq ru
  2. MinRMenuW equ 18*6+10
  3. else
  4. MinRMenuW equ 15*6+10
  5. end if
  6.  
  7. idbRRedrawFon equ 100
  8. idbRAlign    equ 101
  9. idbRFixIcons equ 102
  10. idbRAdd      equ 103
  11. idbRDel      equ 104
  12. idbRProp     equ 105
  13.  
  14. ;---- thread for rbutton -----------------------------------------------------------------------
  15. RButtonWin:
  16.         mcall   40,100101b      ;SetMaskMessage 100101b
  17.         mcall   48,3,sc,40
  18.         stdcall GetNumIcon,[MouseX],[MouseY],-1
  19.         mov     [SelIcon],eax
  20.  
  21.         cmp     eax,-1
  22.         jne     @f
  23.         mov     [RMenuH],16*4+3+3
  24.         mov     [RMenuHsb],16*4+3+3
  25.         jmp     .rbw1
  26.       @@:
  27.         mov     [RMenuH],16*5+3+3
  28.         mov     [RMenuHsb],16*5+3+3
  29.     .rbw1:
  30.  
  31.         mov     [NumUserButt],0
  32.         mov     [RMenuW],0
  33.         mcall   70,fiIni
  34.         mcall   68,12,dword[bufIni+32]
  35.         mov     [RBUser],eax
  36.         stdcall [ini_enum_keys],IconIni,secRButt,GetUserBut
  37.  
  38.  
  39. RBWRedraw:
  40.         mcall   12,1    ;RedrawWinBeg
  41.         mov     ebx,[MouseX]
  42.         shl     ebx,16
  43.         mov     bx,[RMenuW]
  44.         mov     ecx,[MouseY]
  45.         shl     ecx,16
  46.         mov     cx,[RMenuH]
  47.         mov     edx,0177CCFFh
  48.         mov     esi,01000000h
  49.         xor     eax,eax
  50.         int     40h
  51.  
  52.        ;-----------
  53.         mov     ecx,[NumUserButt]
  54.   .DrawUB:
  55.         push    ecx
  56.  
  57.         mov     eax,[NumUserButt]
  58.         sub     eax,ecx
  59.         mov     edx,eax      ;button ID
  60.         shl     eax,4+16          ;*16*10000h
  61.         mov     ecx,eax
  62.         mov     cx,16
  63.  
  64.         xor     ebx,ebx
  65.         mov     bx,[RMenuW]
  66.         mov     esi,[sc.work]   ;[RBMenuColor];0888888h
  67.         mcall   8
  68.  
  69.         mov     ebx,50000h
  70.         shr     ecx,16
  71.         mov     bx,cx
  72.         add     bx,5
  73.  
  74.         mov     ecx,80000000h
  75.  
  76.         mov     eax,[NumUserButt]
  77.         sub     eax,[esp]
  78.         mov     edx,[RBUser+eax*8]
  79.  
  80.         mcall   4
  81.  
  82.         pop     ecx
  83.         loop    .DrawUB
  84.  
  85.        ;-----------
  86.         xor     ebx,ebx
  87.         mov     bx,[RMenuW]
  88.         mov     cx,[RMenuH]
  89.         sub     cx,[RMenuHsb]
  90.         push    ecx
  91.         mov     dx,cx
  92.         shl     ecx,16
  93.         mov     cx,dx
  94.  
  95.                                    ;¯¥à¢ ï à §¤¥«¨â¥«ì­ ï «¨­¨ï
  96. ;        mcall   38,,,[RBMenuColor];0888888h
  97.         mcall   38,,,[sc.work]
  98.         add     ecx,00010001h
  99.         mcall     ,,,
  100.  
  101.        ;------------
  102.         mov     ecx,[esp]
  103.         add     ecx,2
  104.         shl     ecx,16
  105.         mov     cx,16
  106.  
  107. ;        mcall   8,,,idbRRedrawFon,[RBMenuColor];0888888h  ;3 ª­®¯ª¨ ¢â®à®£® ¡«®ª 
  108.         mcall   8,,,idbRRedrawFon,[sc.work]
  109.         add     ecx,00100000h
  110.         mcall    ,,,idbRAlign
  111.         add     ecx,00100000h
  112.         mcall    ,,,idbRFixIcons
  113.  
  114.         mov     ebx,50000h
  115.         mov     bx,word[esp]
  116.         add     bx,2+5
  117.         mcall   4,,80000000h,RMenuRedrawFon
  118.         add     ebx,16
  119.         mcall    ,,,RMenuAlign
  120.  
  121.         add     ebx,16
  122.         cmp     [bFixIcons],0
  123.         jne     @f
  124.         mov     edx,RMenuOffMoving
  125.         jmp     .RBWR1
  126.      @@:
  127.         mov     edx,RMenuOnMoving
  128.      .RBWR1:
  129.         mcall
  130.  
  131.        ;------------
  132.         xor     ebx,ebx               ;¢â®à ï à §¤¥«¨â¥«ì­ ï «¨­¨ï
  133.         mov     bx,[RMenuW]
  134.         mov     ecx,[esp]
  135.         add     ecx,16*3+2
  136.         mov     dx,cx
  137.         shl     ecx,16
  138.         mov     cx,dx
  139. ;        mcall   38,,,[RBMenuColor];0888888h
  140.         mcall   38,,,[sc.work]
  141.         add     ecx,00010001h
  142.         mcall     ,,,
  143.        ;------------
  144.                                      ;1 ¨«¨ 2 ª­®¯ª¨ âà¥â쥣® ¡«®ª 
  145.         mov     ecx,[esp]
  146.         add     ecx,16*3+4
  147.         shl     ecx,16
  148.         mov     cx,16
  149.         cmp     dword[SelIcon],-1
  150.         je      @f
  151.  
  152. ;        mcall   8,,,idbRDel,[RBMenuColor];0888888h
  153.         mcall   8,,,idbRDel,[sc.work]
  154.         add     ecx,00100000h
  155. ;        mcall    ,,,idbRProp,[RBMenuColor];0888888h
  156.         mcall    ,,,idbRProp,[sc.work]
  157.  
  158.         mov     ebx,50000h
  159.         mov     bx,word[esp]
  160.         add     bx,16*3+4+5
  161.         mcall   4,,80000000h,RMenuDel
  162.         add     bx,16
  163.         mcall    ,,         ,RMenuProp
  164.  
  165.         jmp     .endRM
  166.       @@:
  167.  
  168. ;        mcall   8,,,idbRAdd,[RBMenuColor];0888888h
  169.         mcall   8,,,idbRAdd,[sc.work]
  170.         mov     ebx,50000h
  171.         mov     bx,word[esp]
  172.         add     bx,16*3+4+5
  173.         mcall   4,,80000000h,RMenuAdd
  174.  
  175.       .endRM:
  176.  
  177.         pop     ecx
  178.         mcall   12,2    ;RedrawWinEnd
  179.  
  180.         mcall   9,RBProcInfo,-1         ;GetThreadInfo RBProcInfo,-1
  181.         mcall   18,21,dword[RBProcInfo+30]
  182.         m2m     dword[RBSlot],eax
  183.  
  184. RBWMessages:
  185.         mcall   10              ;WaitMessage
  186.         dec     eax
  187.         jz      RBWRedraw
  188.         sub     eax,2
  189.         jz      RBWButton
  190.         sub     eax,3
  191.         jz      RBWMouse
  192.         jmp     RBWMessages
  193.  
  194. RBWButton:
  195.         mcall   17              ;GetButtonPressed
  196.         shr     eax,8
  197.         cmp     eax,idbRRedrawFon
  198.         jz      RBRedrawFon
  199.         cmp     eax,idbRAlign
  200.         jz      RBAlign
  201.         cmp     eax,idbRFixIcons
  202.         jz      RBFixIcons
  203.         cmp     eax,idbRAdd
  204.         jz      RBAdd
  205.         cmp     eax,idbRDel
  206.         jz      RBDelete
  207.         cmp     eax,idbRProp
  208.         jz      RBPropeties
  209.  
  210.         cmp     eax,[NumUserButt]
  211.         ja      @f
  212.  
  213.         mov     eax,[RBUser+eax*8+4]
  214.         mov     dword[fiRunProg+8],0
  215.         mov     dword[fiRunProg+21],eax
  216.         mcall   70,fiRunProg
  217.     @@:
  218.         jmp     RBWExit
  219.  
  220. RBWMouse:
  221.         mcall   37,2            ;GetMouseKey
  222.         test    eax,111b
  223.         jz      RBWMessages
  224.         mcall   37,0            ;GetMousePos
  225.         xor     ebx,ebx
  226.         mov     bx,ax           ;y
  227.         shr     eax,16          ;x
  228.  
  229.         xor     ecx,ecx
  230.         mov     cx,bx
  231.         mov     bx,ax
  232.  
  233.         mcall   34
  234.         cmp     eax,[RBSlot]
  235.         je      RBWMessages
  236.  
  237. RBWExit:
  238.         mcall   68,13,[RBUser]
  239.         mov     [RButtonActiv],0
  240.         mcall   -1      ;ExitProcess
  241.  
  242.  
  243. RBRedrawFon:
  244.         mcall   15,3
  245.         jmp     RBWExit
  246.  
  247. RBAlign:
  248.         call    AlignIcons
  249.  
  250.         m2m     [PIcoDB],[BegData]
  251.         stdcall [ini_enum_sections],IconIni,Ini_SavePos
  252.  
  253.         mov     dword[fiRunProg+8],WarningSave
  254.         mov     dword[fiRunProg+21],pthNotify
  255.         mcall   70,fiRunProg
  256.         mov     [bNotSave],0
  257.  
  258.         jmp     RBRedrawFon
  259.  
  260. RBFixIcons:
  261.         xor     dword[bFixIcons],1
  262.  
  263.         cmp     [bNotSave],0
  264.         je      @f
  265.  
  266.         mov     dword[fiRunProg+8],WarningSave
  267.         mov     dword[fiRunProg+21],pthNotify
  268.         mcall   70,fiRunProg
  269.         mov     [bNotSave],0
  270.  
  271.       @@:
  272.         jmp     RBWExit
  273.  
  274. RBAdd:
  275.         cmp     [DlgAddActiv],1
  276.         je      RBWSetActivWin
  277.         mov     [DlgAddActiv],1
  278.  
  279.         mcall   51,1,DlgAdd,stack_dlg           ;CreateThread DlgAdd,stack_dlg
  280.         jmp     RBWExit
  281.  
  282. RBDelete:
  283.  
  284.         mov     eax,[SelIcon]
  285.         mov     eax,[IconsOffs+eax*4]
  286.         stdcall [ini_del_section],IconIni,eax
  287.  
  288.         stdcall DelIcon,[SelIcon]
  289.     ;    mov     dword[fiStdIco],2
  290.     ;    m2m     dword[fInfo+12],dword[SizeData]
  291.     ;    mcall   70,fInfo
  292.  
  293.         mov     dword[fiRunProg+8],WarningSave
  294.         mov     dword[fiRunProg+21],pthNotify
  295.         mcall   70,fiRunProg
  296.         mov     [bNotSave],0
  297.  
  298.         jmp     RBRedrawFon
  299.  
  300. RBPropeties:
  301.         cmp     [DlgAddActiv],1
  302.         je      RBWSetActivWin
  303.         mov     [DlgAddActiv],1
  304.  
  305.         mcall   51,1,DlgProp,stack_dlg          ;CreateThread DlgProp,stack_dlg
  306.         jmp     RBWExit
  307.  
  308. RBWSetActivWin:
  309.         mcall   18,3,[slotDlgAdd]
  310.         jmp     RBWExit
  311.  
  312.  
  313. proc AlignIcons
  314. local posX:WORD,\
  315.       posY:WORD,\
  316.       negatX:WORD,\
  317.       negatY:WORD
  318.  
  319.         xor     ebx,ebx
  320.  
  321.         mov     ecx,[MaxNumIcon]
  322.         test    ecx,ecx
  323.         jnz     .AlignIco
  324.         ret
  325.  .AlignIco:
  326.         push    ecx
  327.         or      ecx,-1
  328.         mov     edi,dword[IconsOffs+ebx]
  329.         xor     eax,eax
  330.         repne   scasb
  331.         repne   scasb
  332.         repne   scasb
  333.         repne   scasb
  334.  
  335.         mov     dword[negatX],0
  336.  
  337.      ;-------- ¯à¥®¡à §ã¥¬ ª®®à¤¨­ âë ¢ ¯®«®¦¨â¥«ì­ë¥
  338.         mov     ax,[edi+2]
  339.         test    ax,8000h
  340.         jz      @f
  341.         neg     ax
  342.         mov     word[negatX],1
  343.       @@:
  344.         mov     [posX],ax
  345.  
  346.         mov     ax,[edi]
  347.         test    ax,8000h
  348.         jz      @f
  349.         neg     ax
  350.         mov     word[negatY],1
  351.       @@:
  352.         mov     [posY],ax
  353.  
  354.       ;-----
  355.         mov     ax,[posY]
  356.         mov     dx,ALIGN_SIZE
  357.  
  358.         cmp     ax,dx
  359.         jb      .AI0
  360.     @@: sub     ax,dx
  361.         cmp     ax,dx
  362.         jae     @b
  363.     .AI0:
  364.  
  365.         mov     dx,ax
  366.         cmp     dx,ALIGN_SIZE/2
  367.         jb      .AI1
  368.  
  369.         mov     ax,ALIGN_SIZE
  370.         sub     ax,dx
  371.         add     [posY],ax
  372.  
  373.         jmp     .AI2
  374.      .AI1:
  375.         sub     [posY],dx
  376.      .AI2:
  377.      ;-----
  378.         mov     ax,[posX]
  379.         mov     dx,ALIGN_SIZE
  380.  
  381.         cmp     ax,dx
  382.         jb      .AI3
  383.     @@: sub     ax,dx
  384.         cmp     ax,dx
  385.         jae     @b
  386.     .AI3:
  387.  
  388.         mov     dx,ax
  389.         cmp     dx,ALIGN_SIZE/2
  390.         jb      .AI4
  391.  
  392.         mov     ax,ALIGN_SIZE
  393.         sub     ax,dx
  394.         add     [posX],ax
  395.  
  396.         jmp     .AI5
  397.      .AI4:
  398.         sub     [posX],dx
  399.      .AI5:
  400.  
  401.       ;----- ¯à¥®¡à §®¢ ­¨¥ ­ § ¤ ¨ ¯®¯à ¢ª  ¢ ®âà¨æ â¥«ì­ëå ª®®à¤¨­ â
  402.         mov     ax,[posX]
  403.  
  404.         cmp     [negatX],1
  405.         jne     @f
  406.         neg     ax
  407.         inc     ax
  408.         jmp     .AI6
  409.       @@:
  410.  
  411.         mov     dx,[ScreenX]
  412.         shr     dx,1
  413.         cmp     ax,dx
  414.         jbe     .AI6
  415.         sub     ax,[ScreenX]
  416.       .AI6:
  417.         mov     word[edi+2],ax
  418.  
  419.  
  420.         mov     ax,[posY]
  421.         cmp     [negatY],1
  422.         jne     @f
  423.         neg     ax
  424.         inc     ax
  425.         jmp     .AI7
  426.       @@:
  427.  
  428.         mov     dx,[ScreenY]
  429.         shr     dx,1
  430.         cmp     ax,dx
  431.         jbe     .AI7
  432.         sub     ax,[ScreenY]
  433.       .AI7:
  434.          mov     word[edi],ax
  435.  
  436.        ;--------
  437.  
  438.  
  439.  
  440.         pop     ecx
  441.         add     ebx,4
  442.         dec     ecx
  443.         jnz     .AlignIco
  444. ;        loop    .AlignIco
  445.  
  446.  
  447. ;        mov     dword[fInfo],2
  448. ;        mcall   70,fInfo
  449.         ret
  450. endp
  451.  
  452. ;-------------------------------------------------------------------------------
  453. proc GetUserBut stdcall,f_name,sec_name,key_name,key_value
  454.         cmp     [NumUserButt],16
  455.         jne     @f
  456.         ret
  457.      @@:
  458.  
  459.         push    ebx esi edi
  460.  
  461.         mov     edi,[key_name]
  462.         mov     esi,keyMenuColor
  463.     @@: lodsb
  464.         scasb
  465.         jne     @f
  466.         test    al,al
  467.         jnz     @b
  468.  
  469.         stdcall [ini_get_color],[f_name],[sec_name],[key_name],0888888h
  470.         mov     [RBMenuColor],eax
  471.         ret
  472.    @@:
  473.  
  474.         mov     edi,[key_name]           ;®¯à¥¤¥«ï¥¬ è¨à¨­ã ¬¥­î
  475.         xor     eax,eax
  476.         or      ecx,-1
  477.         repne   scasb
  478.         sub     edi,[key_name]
  479.         mov     eax,edi
  480.         shl     eax,1
  481.         lea     eax,[eax*2+eax+5*2]
  482.         cmp     ax,[RMenuW]
  483.         jbe     @f
  484.         mov     [RMenuW],ax
  485.      @@:
  486.         cmp     [RMenuW],MinRMenuW
  487.         jae     @f
  488.         mov     [RMenuW],MinRMenuW
  489.      @@:
  490.  
  491.         mov     ebx,[NumUserButt]
  492.  
  493.         mov     esi,[key_name]
  494.         mov     edi,[RBUser+ebx*8]
  495.     @@: lodsb
  496.         stosb
  497.         test    al,al
  498.         jnz     @b
  499.  
  500. ;debug_newline
  501.  
  502.  
  503.         mov     [RBUser+ebx*8+4],edi
  504.         mov     esi,[key_value]
  505.     @@: lodsb
  506.         stosb
  507.         test    al,al
  508.         jnz     @b
  509.  
  510.         mov     [RBUser+ebx*8+8],edi
  511.  
  512.         inc     [NumUserButt]
  513.         add     [RMenuH],16
  514.  
  515.         pop     edi esi ebx
  516.         mov     eax,1
  517.         ret
  518. endp
  519.  
  520. proc Ini_SavePos stdcall,f_name,sec_name
  521.         push    ebx edi esi
  522.  
  523.         xor     ebx,ebx
  524.   .SearchSect:
  525.         mov     edi,[IconsOffs+ebx*4]
  526.         mov     esi,[sec_name]
  527.       @@:
  528.         lodsb
  529.         scasb
  530.         jne     @f
  531.         test    al,al
  532.         jnz     @b
  533.  
  534.         jmp     .IcoDataFound
  535.       @@:
  536.  
  537.         inc     ebx
  538.         cmp     ebx,[MaxNumIcon]
  539.         jb      .SearchSect
  540.  
  541.         mov     eax,1
  542.         pop     esi edi ebx
  543.         ret
  544.  
  545. .IcoDataFound:
  546.         or      ecx,-1
  547.         repne   scasb
  548.         repne   scasb
  549.         repne   scasb
  550.  
  551. ;int3
  552.         movzx   eax,word[edi+2]
  553.         test    eax,8000h
  554.         jz      @f
  555.         or      eax,0FFFF0000h
  556.      @@:
  557.  
  558.         stdcall [ini_set_int],[f_name],[sec_name],keyX,eax
  559.  
  560.         movzx   eax,word[edi]
  561.         test    eax,8000h
  562.         jz      @f
  563.         or      eax,0FFFF0000h
  564.      @@:
  565.  
  566.         stdcall [ini_set_int],[f_name],[sec_name],keyY,eax
  567.  
  568.         mov     eax,1
  569.         pop     esi edi ebx
  570.         ret
  571. endp
  572.  
  573.  
  574.  
  575.