Subversion Repositories Kolibri OS

Rev

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

  1. ;*****************************************************************************
  2. ; zSea - advanced image viewer for KolibriOS
  3. ; Copyright (c) 2008-2011, 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. ;       v.1.0 rñ4 25.09.2011
  29. ;******************************************************************************
  30.         use32
  31.         org 0x0
  32.         db 'MENUET01'   ; 8 byte id
  33.         dd 0x01         ; header version
  34.         dd START        ; start of code
  35.         dd IM_END       ; size of image
  36.         dd I_END        ; memory for app
  37.         dd stacktop     ; esp
  38.         dd temp_area    ; I_Param
  39.         dd path         ; APPLICATION PACH
  40.  
  41. include 'lang.inc'
  42. ;include 'macros.inc'
  43. ;include 'editbox_ex.mac'
  44. ;include 'proc32.inc'
  45.  
  46. include '../../macros.inc'
  47. include '../../develop/libraries/box_lib/trunk/box_lib.mac'
  48. include '../../proc32.inc'
  49.  
  50. ;include 'load_lib.mac'
  51. include '../../develop/libraries/box_lib/load_lib.mac'
  52.         @use_library    ;use load lib macros
  53. ;******************************************************************************
  54.  
  55. START:                          ; start of execution
  56.         mcall   68, 11
  57.         mcall   66, 1,1
  58.         mcall 40, 0x27
  59.  
  60.         mcall 9, procinfo, -1
  61.         mov     eax,[ebx+30]
  62.         mov     [PID],eax
  63.         xor     ecx,ecx
  64. @@:
  65.         inc     ecx
  66.         mcall 9, procinfo
  67.         mov     eax,[PID]
  68.         cmp     eax,[ebx+30]
  69.         jne     @r
  70.         mov     [active_process],ecx
  71.  
  72.         mcall   48,4
  73.         mov     [skin_height],eax
  74.        
  75.         mcall   68,12,1024
  76.         mov     [menu_data_1.procinfo],eax
  77.         mov     [menu_data_2.procinfo],eax
  78.         mov     [menu_data_3.procinfo],eax
  79.         mov     [menu_data_4.procinfo],eax
  80.         mov     [menu_data_5.procinfo],eax
  81.         mov     [menu_data_6.procinfo],eax
  82.  
  83.         mov     [load_directory_pointer],dir_header
  84.  
  85.  
  86.         call    load_plugins
  87.  
  88.         ;init_checkboxes2 check1,...
  89.         push    check1
  90.         call    [init_checkbox]
  91.         push    check2
  92.         call    [init_checkbox]
  93.  
  94.         call    load_buttons
  95.  
  96. ;       call    init_data_OpenDialog
  97.  
  98. ;init_OpenDialog        OpenDialog_data
  99.         push    dword OpenDialog_data
  100.         call    [OpenDialog_Init]
  101.  
  102.         call    get_filter_data
  103.  
  104. ;-----------------------------------------------------
  105. ; check for parameters
  106.         cmp     dword [temp_area],'BOOT'
  107.         jne     .no_boot
  108. .background:
  109.         call    load_image
  110.         cmp     [error_fs],0
  111.         jnz     .exit
  112.         call    convert
  113.  
  114.         call    background
  115.  
  116. .exit:
  117.         call Set_ini
  118. .exit_1:
  119.         mov     ebx,18
  120.         mov     edx,PID1
  121.         mov     esi,7
  122. .kill_successors:
  123.         mov     ecx,[edx]
  124.         add     edx,4
  125.         test    ecx,ecx
  126.         jz      @f
  127.         mcall 18
  128. @@:
  129.         dec     esi
  130.         jnz     .kill_successors
  131.        
  132.         mcall -1
  133. ;-----------------------------------------------------
  134.  .no_boot:
  135.         xor     eax,eax
  136.         cmp     byte [temp_area],al
  137.         jnz     @f
  138.         mov     [file_name],eax
  139.         jmp .no_param
  140. @@:
  141.  
  142.  
  143.         mov     edi,string      ; clear string
  144.         mov     ecx,256/4       ;       length of a string
  145.         xor     eax,eax ;       symbol <0>
  146.         rep     stosd
  147.  
  148.  
  149.         mov     edi,temp_area   ; look for <0> in temp_area
  150.  
  151.         cmp     [edi],byte "\"
  152.         jne     .continue
  153.         cmp     [edi+1],byte "T"
  154.         jne     @f
  155.         mov     [bgrmode],dword 1
  156.         jmp     .continue_1
  157. @@:
  158.         cmp     [edi+1],byte "S"
  159.         jne     START.exit
  160.         mov     [bgrmode],dword 2
  161. .continue_1:
  162.         add     edi,4
  163. .continue:
  164.         mov     esi,edi
  165.         mov     ecx,257 ;       strlen
  166.         repne scasb
  167.         lea             ecx, [edi-temp_area]
  168.  
  169.         mov     edi,string
  170.         rep     movsb           ; copy string from temp_area to "string" (filename)
  171.         cmp     [temp_area],byte "\"
  172.         je      START.background
  173.         call    load_directory
  174.         test    eax,eax
  175.         jnz     @f
  176.         call    load_image
  177.         test    eax,eax
  178.         jnz     @f
  179.         call    convert
  180.         jmp     .no_param
  181. @@:
  182.         mov     [load_directory_pointer],dir_header
  183.         mov     [error_fs],eax
  184.         call    convert.error
  185. ;-----------------------------------------------------
  186.  .no_param:
  187. ;       or      ecx,-1          ; get information about me
  188. ;       call getappinfo
  189.  
  190. ;       mov edx,[process_info+30] ; Ă²Ă¥Ă¯Ă¥Ă°Ă¼ Ă¢ edx íàø Ă¨Ă¤Ă¥Ă­Ă²Ă¨Ă´Ă¨ĂªĂ Ă²Ă®Ă°
  191. ;       mov ecx,eax
  192.  
  193. ;       @@:
  194. ;       call getappinfo
  195. ;       cmp edx,[process_info+30]
  196. ;       je      @f      ; Ă¥Ă±Ă«Ă¨ íàø PID Ă±Ă®Ă¢Ă¯Ă Ă« ñ PID Ă°Ă Ă±Ă±Ă¬Ă Ă²Ă°Ă¨Ă¢Ă Ă¥Ă¬Ă®Ă£Ă® Ă¯Ă°Ă®Ă¶Ă¥Ă±Ă±Ă , ìû íàøëè Ă±Ă¥Ă¡Ă¿
  197. ;       dec ecx ; Ă¨Ă­Ă Ă·Ă¥ Ă±Ă¬Ă®Ă²Ă°Ă¨Ă¬ Ă±Ă«Ă¥Ă¤Ă³Ă¾Ă¹Ă¨Ă© Ă¯Ă°Ă®Ă¶Ă¥Ă±Ă±
  198. ;       jne @b  ; Ă¢Ă®Ă§Ă¢Ă°Ă Ă¹Ă Ă¥Ă¬Ă±Ă¿, Ă¥Ă±Ă«Ă¨ Ă­Ă¥ Ă¢Ă±Ă¥ Ă¯Ă°Ă®Ă¶Ă¥Ă±Ă±Ă» Ă°Ă Ă±Ă±Ă¬Ă®Ă²Ă°Ă¥Ă­Ă»
  199. ;       @@:
  200.  
  201. ; Ă²Ă¥Ă¯Ă¥Ă°Ă¼ Ă¢ ecx Ă­Ă®Ă¬Ă¥Ă° Ă¯Ă°Ă®Ă¶Ă¥Ă±Ă±Ă 
  202. ;       mov     [process],ecx
  203. ;---------------------------------------------------------------------
  204.         cmp     [wnd_width],635
  205.         jae     @f
  206.         mov     [wnd_width],635
  207. @@:
  208.         cmp     [wnd_height],150
  209.         jae     @f
  210.         mov     [wnd_height],150
  211. @@:
  212. ;       call draw_window
  213. red:
  214. ;draw_still:
  215. ;       pusha
  216.         call    get_window_param
  217.         test    [window_status],10b
  218.         jnz     red_1   ;still
  219.         test    [window_status],100b
  220.         jnz     red_1
  221.         test    [window_status],1b
  222.         jnz     red_1
  223.         mov esi,-1
  224.         mov eax,procinfo
  225.         mov eax,[eax+66]
  226.         cmp     eax,150
  227. ;       cmp     [window_high],150
  228.         jae     @f
  229.         mov     esi,150
  230.         mcall 67,-1,ebx,ebx
  231. @@:
  232.         mov edx,-1
  233.         mov eax,procinfo
  234.         mov eax,[eax+62]
  235.         cmp     eax,635
  236. ;       cmp     [window_width],635
  237.         jae     @f      ;red_1
  238.         mov     edx,635
  239.         mcall 67,-1,ebx, ,ebx
  240. @@:
  241. ;       mcall 67,-1,ebx
  242. ;       popa
  243. ;       xor esi,esi
  244. red_1:
  245. ;       xor     eax,eax
  246. ;       mov     [scroll_bar_data_vertical.position],eax
  247. ;       mov     [scroll_bar_data_horizontal.position],eax
  248.  
  249.         call draw_window
  250.        
  251.         cmp     [redraw_wallpaper_flag],0
  252.         je      still
  253.         mov     [redraw_wallpaper_flag],0
  254.         call    clear_thread
  255. ;       mcall 15,3
  256. ;       jmp  red_1
  257. still:
  258.         call    pause_cicle
  259.        
  260.         cmp     [RAW1_flag],1
  261.         je      animation_handler
  262.        
  263.         mcall   48,4
  264.         cmp     [skin_height],eax
  265.         je      @f
  266.         mov     [skin_height],eax
  267.         call    convert.img_resolution_ok
  268.         jmp     red_1
  269. @@:
  270.         mcall   10
  271. .1:
  272.         cmp     [open_file_flag],1
  273.         je      kopen_1
  274.         cmp     [sort_directory_flag],byte 1
  275.         je      red_sort_directory
  276.         cmp     [redraw_flag],byte 1
  277.         je      redraw_window
  278.         cmp     eax,1   ; Ă¯Ă¥Ă°Ă¥Ă°Ă¨Ă±Ă®Ă¢Ă Ă²Ă¼ Ă®ĂªĂ­Ă® ?
  279.         je              red     ; Ă¥Ă±Ă«Ă¨ äà - Ă­Ă  Ă¬Ă¥Ă²ĂªĂ³ red
  280.         cmp     eax,2   ; Ă­Ă Ă¦Ă Ă²Ă  ĂªĂ«Ă Ă¢Ă¨Ă¸Ă  ?
  281.         je              key     ; Ă¥Ă±Ă«Ă¨ äà - Ă­Ă  key
  282.         cmp     eax,3   ; Ă­Ă Ă¦Ă Ă²Ă  ĂªĂ­Ă®Ă¯ĂªĂ  ?
  283.         je              button          ; Ă¥Ă±Ă«Ă¨ äà - Ă­Ă  button
  284.         cmp     eax,6
  285.         je      mouse
  286. ;       cmp [redraw_wallpaper_flag],1
  287. ;       jne still
  288. ;       mov     [redraw_wallpaper_flag],0
  289. ;       mcall   15,3
  290.         jmp     still   ; Ă¥Ă±Ă«Ă¨ Ă¤Ă°Ă³Ă£Ă®Ă¥ Ă±Ă®Ă¡Ă»Ă²Ă¨Ă¥ - Ă¢ Ă­Ă Ă·Ă Ă«Ă® Ă¶Ă¨ĂªĂ«Ă 
  291.  
  292. red_sort_directory:
  293.         mov     [sort_directory_flag],byte 0
  294.         jmp     red_1
  295.  
  296. redraw_window:
  297.         mov     [redraw_flag],byte 0
  298.         jmp     red_1
  299.        
  300. ;---------------------------------------------------------------------
  301. ;       red:
  302. ;       test    dword [status], 4
  303. ;       jz      draw_still
  304. ;       mov     al,18
  305. ;       mov     ebx,3
  306. ;       mov     ecx,[process]
  307. ;       mcall   18,3,[active_process]
  308. ;       and     byte [status], not 4
  309. ;       jmp     still
  310. ;---------------------------------------------------------------------
  311. button:                 ; button
  312.         mov     eax,17          ; get id
  313.         mcall
  314.         cmp     ah,1                    ; button id=1 ?
  315.         je      START.exit
  316. ;       jne     .noclose
  317. ;
  318. ;       mov     eax,-1          ; close this program
  319. ;       mcall
  320. .noclose:
  321.         cmp     ah,2
  322.         je      slide_show.3    ;still
  323.         jmp     slide_show
  324. ;---------------------------------------------------------------------
  325. pause_cicle:
  326.         pusha
  327. .start:
  328.         mcall   9,procinfo,-1
  329.         mov     eax,[procinfo+70] ;status of window
  330.         test    eax,100b
  331.         jne     @f
  332.         popa
  333.         ret
  334. @@:
  335.         mcall   10
  336.         dec     eax
  337.         jz      .redraw
  338.         dec     eax
  339.         jz      .key
  340.         dec     eax
  341.         jnz     .start 
  342. .button:
  343.         mcall   -1
  344. .key:
  345.         mcall   2
  346.         jmp     .start
  347. .redraw:
  348.         call    draw_window
  349.         jmp     .start
  350. ;---------------------------------------------------------------------
  351. get_filter_data:
  352.         mov     edi,Filter+4
  353.         xor     eax,eax
  354.         mov     ecx,10
  355.         cld
  356. @@:
  357.         mov     esi,10
  358.         sub     esi,ecx
  359.         lea     esi,[esi+esi*2] ; x 3
  360.         shl     esi,3  ; x 8
  361.         add     esi,dword Convert_plugin_0.Assoc
  362.         mov     esi,[esi]
  363.         add     esi,4
  364.  
  365.         test    esi,esi
  366.         jz      @f
  367.         call    .start
  368.         dec     ecx
  369.         jnz     @r
  370. @@:
  371.         mov     [edi],byte 0
  372.         mov     eax,Filter
  373.         sub     edi,eax
  374.         mov     [eax],edi
  375.  
  376.         ret
  377. .start:
  378. @@:
  379.         lodsb
  380.         stosb
  381.         test    eax,eax
  382.         jnz     @r
  383.         cmp     [esi],ah
  384.         jne     @r
  385.         ret
  386. ;---------------------------------------------------------------------
  387. kopen_1:
  388.  
  389.         mov     [open_file_flag],0
  390.         call    load_directory
  391.         test    eax,eax
  392.         jz      kopen
  393. .err:
  394.         mov     [load_directory_pointer],dir_header
  395.         mov     [error_fs],eax
  396.         call    convert.error
  397.         jmp     still   ;red_1
  398.  
  399. kopen:
  400.         cmp     [string],byte 0
  401.         je      still
  402.  
  403.         mov     ecx,-1
  404.         call    getappinfo
  405.  
  406.         call    load_image
  407.  
  408.         test    eax,eax
  409.         jnz     kopen_1.err
  410.         call    convert
  411.  
  412. .1:
  413.         call    get_window_param
  414.         test    [window_status],1b
  415.         jz      red     ;draw_still
  416.         mov     [no_draw_window],1
  417.  
  418. ;       push    edx
  419. ;       mov     edx,size_after_convert_2
  420. ;       call    write_memory_size
  421. ;       pop     edx
  422.  
  423.         call    draw_other
  424.  
  425.         mov     [no_draw_window],0
  426. ;       jmp     draw_still
  427.         jmp     still
  428. ;---------------------------------------------------------------------
  429. getappinfo:
  430.         mov     eax,9
  431.         mov     ebx,process_info
  432.         mcall
  433.         ret
  434. ;---------------------------------------------------------------------
  435. get_window_param:
  436.         mcall   9, procinfo, -1
  437.         mov     eax,[ebx+34]
  438.         mov     [window_start_x],eax
  439.         mov     eax,[ebx+38]
  440.         mov     [window_start_y],eax
  441.         mov     eax,[ebx+66]   ;46]
  442.         inc     eax
  443.         mov     [window_high],eax
  444.         mov     eax,[ebx+62]   ;42]
  445.         inc     eax
  446.         mov     [window_width],eax
  447.         mov     eax,[ebx+70]
  448.         mov     [window_status],eax
  449. ;       mcall   48,4
  450. ;       mov     [skin_high],eax
  451.         ret
  452. ;---------------------------------------------------------------------
  453. ;write_memory_size:
  454. ;       pusha
  455. ;       mcall   9, procinfo, -1
  456. ;       mov     eax,[ebx+26]
  457. ;       mov     [edx],eax
  458. ;       popa
  459. ;       ret
  460. ;---------------------------------------------------------------------
  461. include 'backgrnd.inc'
  462. include 'draw_win.inc'
  463. include 'full_win.inc'
  464. include 'mouse.inc'
  465. include 'key.inc'
  466. include 'menu_key.inc'
  467. include 'clr_bcgr.inc'
  468. include 'w_error.inc'
  469. include 'load.inc'
  470. include 'animat.inc'
  471. include 'draw_img.inc'
  472. include 'convert.inc'
  473. include 'zoom.inc'
  474. include 'w_about.inc'
  475. include 'win_file.inc'
  476. include 'win_info.inc'
  477. include 'win_bcgr.inc'
  478. include 'win_sort.inc'
  479. include 'win_opti.inc'
  480. include 'libini.inc'
  481. include '../../dll.inc'
  482. include 'data.inc'
  483. ;---------------------------------------------------------------------
  484. IM_END:
  485. include 'dat_area.inc'
  486. I_END:
  487.