Subversion Repositories Kolibri OS

Rev

Rev 4200 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;*****************************************************************************
  2. ; Write the data to the clipboard
  3. ; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario
  4. ; All rights reserved.
  5. ;
  6. ; Redistribution and use in source and binary forms, with or without
  7. ; modification, are permitted provided that the following conditions are met:
  8. ;        * Redistributions of source code must retain the above copyright
  9. ;          notice, this list of conditions and the following disclaimer.
  10. ;        * Redistributions in binary form must reproduce the above copyright
  11. ;          notice, this list of conditions and the following disclaimer in the
  12. ;          documentation and/or other materials provided with the distribution.
  13. ;        * Neither the name of the <organization> nor the
  14. ;          names of its contributors may be used to endorse or promote products
  15. ;          derived from this software without specific prior written permission.
  16. ;
  17. ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
  18. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  21. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. ;******************************************************************************
  28.         use32
  29.         org 0x0
  30.  
  31.         db 'MENUET01'
  32.         dd 0x01
  33.         dd START
  34.         dd IM_END
  35.         dd I_END
  36.         dd stacktop
  37.         dd 0x0
  38.         dd 0x0
  39. ;---------------------------------------------------------------------
  40. include '../../../macros.inc'
  41. ;---------------------------------------------------------------------
  42. START:
  43.  
  44. red:
  45.         call    draw_window
  46. still:
  47.         mcall   10
  48.  
  49.         cmp     eax,1
  50.         je      red
  51.         cmp     eax,2
  52.         je      key
  53.         cmp     eax,3
  54.         je      button
  55.  
  56.         jmp     still
  57. ;---------------------------------------------------------------------
  58. key:
  59.         mcall   2
  60.         jmp     still
  61. ;---------------------------------------------------------------------
  62. button:
  63.         mcall   17
  64.        
  65.         cmp     ah,2
  66.         je      .write_button
  67.  
  68.         cmp     ah,3
  69.         je      .delete_button
  70.        
  71.         cmp     ah,1
  72.         jne     still
  73. .exit:
  74.         mcall   -1
  75. ;--------------------------------------
  76. .write_button:
  77.         mcall   54,2,buffer_data.end-buffer_data,buffer_data
  78.         mov     [operation_result],eax
  79.         call    redraw_operation_result
  80.         jmp     still
  81. ;--------------------------------------
  82. .delete_button:
  83.         mcall   54,3
  84.         mov     [operation_result],eax
  85.         call    redraw_operation_result
  86.         jmp     still
  87. ;---------------------------------------------------------------------
  88. draw_window:
  89.         mcall   12,1
  90.         xor     esi,esi
  91.         mcall   0,<0,350>,<0,100>,0x13FFFFFF,,title
  92.        
  93.         mcall   8,<20,130>,<40,20>,2,0xCCCCCC
  94.         mcall   ,<160,155>,,3
  95.         mcall   4,<25,47>,0x90000000,write_button_text
  96.         mcall   ,<165,47>,,delete_button_text
  97.         mcall   ,<25,77>,,operation_result_text
  98.         call    redraw_operation_result
  99.        
  100.         mcall   12,2
  101.         ret
  102. ;---------------------------------------------------------------------
  103. redraw_operation_result:
  104.         mcall   13,<200,100>,<77,8>,0xFFFFFF
  105.         mcall   47,0x80080100,[operation_result],<200,77>,0x10000000
  106.         ret
  107. ;---------------------------------------------------------------------
  108. title:
  109.         db 'Write the data to the clipboard',0
  110. write_button_text:
  111.         db 'Write to clipboard',0
  112. delete_button_text:
  113.         db 'Delete from clipboard',0
  114. operation_result_text:
  115.         db 'Result of the operation:',0
  116. ;---------------------------------------------------------------------
  117. buffer_data:
  118.         dd buffer_data.end - buffer_data
  119.         dd 0    ; type 'text'
  120.         dd 1    ; cp866 text encoding
  121.         db 'Test message to the clipboard'
  122. .end:
  123. ;---------------------------------------------------------------------
  124. IM_END:
  125. operation_result:
  126.         rd 1
  127. ;--------------------------------------        
  128.         rb 1024
  129. stacktop:
  130.         rb 4
  131. ;---------------------------------------------------------------------
  132. I_END:
  133. ;---------------------------------------------------------------------