Subversion Repositories Kolibri OS

Rev

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