Subversion Repositories Kolibri OS

Rev

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

  1.     DEBUG equ 0
  2.  
  3.     LIST_WIDTH equ 256
  4.     WIN_WIDTH equ (LIST_WIDTH + 16 + 12)
  5.     LIST_SIZE equ 12
  6.     LINE_SIZE equ 40
  7.     LIST_HEIGHT equ (LIST_SIZE * LINE_SIZE / 2)
  8.     WIN_HEIGHT equ (LIST_HEIGHT + 80)
  9.  
  10.     use32
  11.     org     0
  12.     db      'MENUET01'
  13.     dd      1, main, dataend, memory, memory, params, 0
  14.  
  15.     include "../../proc32.inc"
  16.     include "../../macros.inc"
  17.     include "../../dll.inc"
  18.     include "../../cmp.inc"
  19.     include "../../string.inc"
  20.     include "../../develop/libraries/box_lib/trunk/box_lib.mac"
  21.  
  22.     include "lang.inc"
  23.  
  24. if DEBUG eq 1
  25.     include "../../debug.inc"
  26. end if
  27.  
  28.  ;===============================
  29.  
  30. if lang eq ru
  31.  title db "Žâªàëâì á ¯®¬®éìî", 0
  32.  browse_txt db "Ž¡§®à...", 0
  33.  notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
  34.  checkbox_txt db "ˆá¯®«ì§®¢ âì ¢á¥£¤ ", 0
  35. else if lang eq et
  36.  title db "Open with", 0
  37.  browse_txt db "Browse...", 0
  38.  notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
  39.  checkbox_txt db "Always use selected program", 0
  40. else if lang eq it
  41.  title db "Open with", 0
  42.  browse_txt db "Browse...", 0
  43.  notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
  44.  checkbox_txt db "Always use selected program", 0
  45. else
  46.  title db "Open with", 0
  47.  browse_txt db "Browse...", 0
  48.  notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
  49.  checkbox_txt db "Always use selected program", 0
  50. end if
  51.  
  52.  sys_dir db "/sys", 0
  53.  slash db "/", 0
  54.  open_dialog_path db "/sys/file managers/opendial", 0
  55.  app_link db "$", 0
  56.  icons db "/sys/icons32.png", 0
  57.  communication_area_name db "FFFFFF_open_dialog", 0
  58.  assoc_ini db "/sys/settings/assoc.ini", 0
  59.   .sec db "Assoc", 0
  60.   .exec db "exec", 0
  61.   .icon db "icon", 0
  62.  
  63.  sb_apps scrollbar \
  64.   13, WIN_WIDTH - 25, LIST_HEIGHT, 10 + 12, \  ;; w, x, h, y
  65.   0, 0, LIST_SIZE / 2, 0, \                    ;; b.h, max, area, pos
  66.   0, 0, 0, 2
  67.  
  68.  cb_always check_box2 \
  69.   5 shl 16 + 16, (LIST_HEIGHT + 33) shl 16 + 16, 6, 0, 0, 0, checkbox_txt, ch_flag_middle
  70.  
  71.  opendialog:
  72.   .type dd 0
  73.   .procinfo dd buffer3
  74.   .com_area_name dd communication_area_name
  75.   .com_area dd 0
  76.   .opendir_path dd buffer4
  77.   .dir_default_path dd sys_dir
  78.   .start_path dd open_dialog_path
  79.   .draw_window dd draw_window
  80.   .status dd 0
  81.   .openfile_pach dd buffer
  82.   .filename_area dd buffer5
  83.   .filter_area dd .filter
  84.   .x:
  85.   .x_size dw 420
  86.   .x_start dw 200
  87.   .y:
  88.   .y_size dw 320
  89.   .y_start dw 120
  90.  
  91.  .filter dd 0
  92.  
  93.  ps_addres:
  94.   dd 0          ;; type
  95.   dw 7          ;; y
  96.   dw 4          ;; x
  97.   dw 6          ;; font.w
  98.   dw LIST_WIDTH ;; w
  99.   dd 0          ;; mono
  100.   dd 0          ;; without bg
  101.   .color dd 0   ;; text color
  102.   dd 0          ;; bg color
  103.   .txt dd 0     ;; text
  104.   dd buffer2
  105.   dd 0
  106.  
  107.  is_execute:
  108.   dd 7, 0, 0, 0, 0
  109.   db 0
  110.   dd buffer
  111.  
  112.  is_openas:
  113.   dd 7, 0, 0, 0, 0
  114.   db 0
  115.   dd buffer
  116.  
  117.  is_open:
  118.   dd 7, 0, 0, 0, 0
  119.   db 0
  120.   dd buffer
  121.  
  122.  is_undefined:
  123.   dd 7, 0, notify_txt, 0, 0
  124.   db "/sys/@notify", 0
  125.  
  126.  is_openimg_info:
  127.   dd 5, 0, 0, 0, img.buf
  128.   db 0
  129.   dd icons
  130.  
  131.  is_openimg:
  132.   dd 0, 0, 0, 0, 0
  133.   db 0
  134.   dd icons
  135.  
  136.  is_file_exists:
  137.   dd 0, 0, 0, 0, buffer6
  138.   db 0
  139.   dd buffer
  140.  
  141.   last_x dd -1
  142.   last_y dd -1
  143.  
  144. if DEBUG eq 1
  145.     std_param db "~/sys/example.asm", 0
  146. end if
  147.  
  148.  imports:
  149.     library libini, "libini.obj"
  150.     import  libini, libini.get_str, "ini_get_str", \
  151.                     libini.set_str, "ini_set_str", \
  152.                     libini.get_num, "ini_get_int", \
  153.                     libini.for_each_section, "ini_enum_sections"
  154.  
  155.  imports_add:
  156.     library libimg, "libimg.obj", \
  157.             boxlib, "box_lib.obj", \
  158.             prclib, "proc_lib.obj"
  159.     import  libimg, libimg.init, "lib_init", \
  160.                     libimg.toRGB, "img_to_rgb2", \
  161.                     libimg.decode, "img_decode", \
  162.                     libimg.destroy, "img_destroy"
  163.     import  boxlib, scrollbar.draw, "scrollbar_v_draw", \
  164.                     scrollbar.mouse, "scrollbar_v_mouse", \
  165.                     pathshow.init, "PathShow_prepare", \
  166.                     pathshow.draw, "PathShow_draw", \
  167.                     checkbox.init, "init_checkbox2", \
  168.                     checkbox.draw, "check_box_draw2", \
  169.                     checkbox.mouse, "check_box_mouse2"
  170.     import  prclib, opendialog.lib_init, "lib_init", \
  171.                     opendialog.init, "OpenDialog_init", \
  172.                     opendialog.start, "OpenDialog_start"
  173.  
  174.  ;===============================
  175.  
  176.  main:
  177.     mcall   68, 11
  178.     stdcall dll.Load, imports
  179.  
  180. if DEBUG eq 1
  181.     stdcall string.copy, std_param, params
  182. end if
  183.  
  184.  ;; trim params
  185.     stdcall string.to_lower_case, params
  186.     stdcall string.trim_last, params
  187.     stdcall string.trim_first, params
  188.     mov     [param_s], eax
  189.  
  190.  ;; if empty - exit
  191.     cmpe    [eax], byte 0, exit
  192.  
  193.  ;; if folder
  194.     stdcall string.length, [param_s]
  195.     add     eax, [param_s]
  196.     cmpe    [eax - 1], byte '/', open
  197.  
  198.  ;; if dialog
  199.     mov     eax, [param_s]
  200.     mov     [is_openas + 8], eax
  201.     cmpne   [eax], byte '~', @f
  202.     inc     [param_s]
  203.     mov     eax, [param_s]
  204.     mov     [is_openas + 8], eax
  205.     jmp     start_dialog
  206.   @@:
  207.  
  208.  ;; if without '.' - execute
  209.     stdcall string.last_index_of, [param_s], '.', 1
  210.     cmpe    eax, -1, execute
  211.  
  212.  ;; if '.' is part of path - execute
  213.     mov     esi, eax
  214.     stdcall string.last_index_of, [param_s], '/', 1
  215.     cmpg    eax, esi, execute
  216.  
  217.  ;; if ext == "kex" - execute
  218.     add     esi, [param_s]
  219.     mov     [param_e], esi
  220.     cmpe    [esi], dword "kex", execute
  221.  
  222.  open_as:
  223.     invoke  libini.get_str, assoc_ini, assoc_ini.sec, esi, buffer, 2048, undefined
  224.     cmpe    [buffer], byte 0, start_dialog_pre
  225.     cmpne   [buffer], byte "$", @f
  226.     invoke  libini.get_str, assoc_ini, buffer + 1, assoc_ini.exec, buffer, 2048, undefined
  227.     cmpe    [buffer], byte 0, ini_error
  228.   @@:
  229.     mcall   70, is_openas
  230.     jmp     exit
  231.  
  232.  execute:
  233.     mov     eax, [param_s]
  234.     mov     [is_execute + 21], eax
  235.     mcall   70, is_execute
  236.     jmp     exit
  237.  
  238.  open:
  239.     invoke  libini.get_str, assoc_ini, assoc_ini.sec, slash, buffer, 2048, undefined
  240.     cmpne   [buffer], byte "$", @f
  241.     invoke  libini.get_str, assoc_ini, buffer + 1, assoc_ini.exec, buffer, 2048, undefined
  242.     cmpe    [buffer], byte 0, ini_error
  243.   @@:
  244.     mov     eax, [param_s]
  245.     mov     [is_open + 8], eax
  246.     mcall   70, is_open
  247.     jmp     exit
  248.  
  249.  ini_error:
  250.     mcall   70, is_undefined
  251.     jmp     exit
  252.  
  253.  ;----------------------
  254.  
  255.  start_dialog_pre:
  256.     or      [cb_always.flags], ch_flag_en
  257.  
  258.  start_dialog:
  259.     stdcall dll.Load, imports_add
  260.     invoke  opendialog.lib_init
  261.  
  262.     mcall   40, 100111b
  263.  
  264.  ;; get title
  265.     stdcall string.copy, title, win.title
  266.  
  267.  ;; get positions
  268.     mcall   14
  269.     movzx   ebx, ax
  270.     shr     ebx, 1
  271.     shr     eax, 16 + 1
  272.     sub     eax, WIN_WIDTH / 2 - 1
  273.     sub     ebx, WIN_HEIGHT / 2 - 1
  274.     mov     [win.x], eax
  275.     mov     [win.y], ebx
  276.  
  277.  ;; get colors
  278.     mcall   48, 3, skin, sizeof.system_colors
  279.  
  280.  ;; get opendialog
  281.     invoke  opendialog.init, opendialog
  282.  
  283.  ;; get pathshow
  284.     mov     eax, [param_s]
  285.     mov     ebx, [skin.work_text]
  286.     mov     [ps_addres.txt], eax
  287.     mov     [ps_addres], ebx
  288.     invoke  pathshow.init, ps_addres
  289.  
  290.  ;; get checkbox
  291.     mov     eax, 0xFFFfff
  292.     mov     ebx, [skin.work_graph]
  293.     mov     ecx, [skin.work_text]
  294.     mov     [cb_always.color], eax
  295.     mov     [cb_always.border_color], ebx
  296.     mov     [cb_always.text_color], ecx
  297.     invoke  checkbox.init, cb_always
  298.  
  299.  ;; get list
  300.     invoke  libini.for_each_section, assoc_ini, section_cb
  301.     mov     eax, [sb_apps.max_area]
  302.     and     eax, 1b
  303.     shr     [sb_apps.max_area], 1
  304.     add     [sb_apps.max_area], eax
  305.  
  306.     mov     eax, 0xFFFfff
  307.     mov     ebx, 0xCCCccc ;[skin.3d]
  308.     mov     [sb_apps.bg_color], eax
  309.     mov     [sb_apps.front_color], ebx
  310.     mov     [sb_apps.line_color], ebx
  311.  
  312.  ;; get icons
  313.     mcall   70, is_openimg_info
  314.     mov     edx, dword [img.buf + 32]
  315.     shl     edx, 4
  316.     stdcall mem.Alloc, edx
  317.     mov     [img.rgb], eax
  318.  
  319.     mov     [is_openimg + 12], edx
  320.     m2m     dword[is_openimg + 16], dword[img.rgb]
  321.     mcall   70, is_openimg
  322.  
  323.     invoke  libimg.decode, dword[img.rgb], ebx, 0
  324.     mov     [img], eax
  325.  
  326.   ;; alpha
  327.     mov     edi, [eax + 8]
  328.     shl     edi, 7
  329.     sub     edi, 4
  330.     mov     eax, [eax + 24]
  331.  .setalpha:
  332.     mov     ebx, [eax + edi]
  333.     shr     ebx, 24
  334.     cmpne   ebx, 0, @f
  335.     mov     ecx, 0xFFFfff
  336.     mov     [eax + edi], ecx
  337.  @@:
  338.     cmpe    edi, 0, @f
  339.     sub     edi, 4
  340.     jmp     .setalpha
  341.  @@:
  342.  
  343.     invoke  libimg.toRGB, [img], [img.rgb]
  344.     invoke  libimg.destroy, [img]
  345.  
  346.  ;----------------------
  347.  
  348.  update:
  349.     mcall   10
  350.     cmpe    eax, EV_REDRAW, event_redraw
  351.     cmpe    eax, EV_KEY, event_key
  352.     cmpe    eax, EV_BUTTON, event_button
  353.     cmpe    eax, EV_MOUSE, event_mouse
  354.     jmp     update
  355.  
  356.  ;----------------------
  357.  
  358.  event_redraw:
  359.     call    draw_window
  360.     jmp     update
  361.  
  362.  ;----------------------
  363.  
  364.  event_key:
  365.     mcall   2
  366.     cmpe    ah, 27, exit
  367.  
  368. ;    cmpe    ah, 179, .go_right
  369. ;    cmpe    ah, 176, .go_left
  370. ;    cmpe    ah, 178, .go_up
  371. ;    cmpe    ah, 177, .go_down
  372. ;    jmp     update
  373. ;
  374. ; .go_right:
  375. ;    jmp     update
  376. ;
  377. ; .go_left:
  378. ;    jmp     update
  379. ;
  380. ; .go_up:
  381. ;    jmp     update
  382. ;
  383. ; .go_down:
  384. ;    stdcall draw_item, [last_x], [last_y], 0
  385. ;
  386. ;    cmpne   [last_x], -1, @f
  387. ;    mov     [last_x], 0
  388. ;  @@:
  389. ;
  390. ;    cmpne   [last_y], LIST_SIZE / 2 - 1, @f
  391. ;    mov     eax, [sb_apps.position]
  392. ;    add     eax, LIST_SIZE / 2
  393. ;    shl     eax, 1
  394. ;    cmpge   eax, [list.size], .pre
  395. ;    inc     [sb_apps.position]
  396. ;    stdcall draw_list
  397. ;    invoke  scrollbar.draw, sb_apps
  398. ;    jmp     update
  399. ; .pre:
  400. ;    dec     [last_y]
  401. ;  @@:
  402. ;
  403. ;    inc     [last_y]
  404. ;    stdcall draw_item, [last_x], [last_y], 1
  405.     jmp     update
  406.  
  407.  ;----------------------
  408.  
  409.  event_button:
  410.     mcall   17
  411.     cmpe    ah, 1, exit
  412.     cmpe    ah, 2, .opendialog
  413.  
  414.  .fromlist:
  415.     movzx   ebx, ah
  416.     sub     ebx, 10
  417.     mov     ecx, [sb_apps.position]
  418.     shl     ecx, 1
  419.     add     ebx, ecx
  420.     shl     ebx, 5
  421.     add     ebx, list
  422.     cmpe    [ebx], byte 0, update
  423.     mov     [param_a], ebx
  424.     invoke  libini.get_str, assoc_ini, ebx, assoc_ini.exec, buffer, 256, undefined
  425.     cmpe    [buffer], byte 0, ini_error
  426.     mcall   70, is_openas
  427.     mov     edi, 1
  428.  
  429.  .save_assoc:
  430.     mov     eax, [cb_always.flags]
  431.     and     eax, ch_flag_en
  432.     cmpe    eax, 0, exit
  433.  
  434.     cmpe    edi, 0, @f
  435.     stdcall string.copy, app_link, buffer
  436.     stdcall string.concatenate, [param_a], buffer
  437.   @@:
  438.  
  439.     invoke  libini.set_str, assoc_ini, assoc_ini.sec, [param_e], buffer, 33
  440.     jmp     exit
  441.  
  442.  .opendialog:
  443.     invoke  opendialog.start, opendialog
  444.     cmpne   [opendialog.status], 1, update
  445.     mcall   70, is_openas
  446.     mov     edi, 0
  447.     jmp     .save_assoc
  448.  
  449.  ;----------------------
  450.  
  451.  event_mouse:
  452.     invoke  checkbox.mouse, cb_always
  453.     mov     edi, [sb_apps.position]
  454.     invoke  scrollbar.mouse, sb_apps
  455.     sub     edi, [sb_apps.position]
  456.     jz      @f
  457.     call    draw_list
  458.   @@:
  459.  
  460.     mcall   37, 1
  461.     movzx   edi, ax
  462.     shr     eax, 16
  463.     mov     esi, eax
  464.     sub     esi, 4
  465.     sub     edi, 10 + 12
  466.     cmpl    esi, 0, .out
  467.     cmpge   esi, LIST_WIDTH, .out
  468.     cmpl    edi, 0, .out
  469.     cmpge   edi, LIST_HEIGHT, .out
  470.  
  471.     mcall   37, 7
  472.     and     eax, 0xFFFF
  473.     cmpe    eax, 65535, .scroll_up
  474.     cmpe    eax, 0, @f
  475.  
  476.  .scroll_down:
  477.     mov     eax, [sb_apps.position]
  478.     add     eax, LIST_SIZE / 2
  479.     shl     eax, 1
  480.     cmpge   eax, [list.size], @f
  481.     inc     [sb_apps.position]
  482.     stdcall draw_list
  483.     invoke  scrollbar.draw, sb_apps
  484.     jmp     update
  485.  
  486.  .scroll_up:
  487.     cmpe    [sb_apps.position], 0, @f
  488.     dec     [sb_apps.position]
  489.     stdcall draw_list
  490.     invoke  scrollbar.draw, sb_apps
  491.     jmp     update
  492.  
  493.   @@:
  494.  
  495.     mov     eax, esi
  496.     mov     ebx, LIST_WIDTH / 2
  497.     mov     edx, 0
  498.     div     ebx
  499.     mov     esi, eax
  500.  
  501.     mov     eax, edi
  502.     mov     ebx, LINE_SIZE
  503.     mov     edx, 0
  504.     div     ebx
  505.     mov     edi, eax
  506.  
  507.     cmpne   esi, [last_x], .redraw
  508.     cmpne   edi, [last_y], .redraw
  509.     jmp     @f
  510.  
  511.  .redraw:
  512.     stdcall draw_item, [last_x], [last_y], 0
  513.     mov     [last_x], esi
  514.     mov     [last_y], edi
  515.     stdcall draw_item, esi, edi, 1
  516.     jmp     @f
  517.  
  518.  .out:
  519.     cmpe    [last_x], -1, @f
  520.     stdcall draw_item, [last_x], [last_y], 0
  521.     mov     [last_x], -1
  522.     mov     [last_y], -1
  523.   @@:
  524.  
  525.     jmp     update
  526.  
  527.  ;----------------------
  528.  
  529.  exit:
  530.     mcall   -1
  531.  
  532.  ;----------------------
  533.  
  534.  proc draw_window
  535.     mcall   12, 1
  536.  
  537.     mov     edx, [skin.work]
  538.     or      edx, 0x34 shl 24
  539.     mcall   0, <[win.x], WIN_WIDTH>, <[win.y], WIN_HEIGHT>, , , win.title
  540.     stdcall draw_list
  541.     invoke  scrollbar.draw, sb_apps
  542.     invoke  pathshow.draw, ps_addres
  543.     invoke  checkbox.draw, cb_always
  544.  
  545.     mcall   13, <207, 66>, <LIST_HEIGHT + 29, 22>, [skin.work_graph]
  546.     mcall   8, <208, 63>, <LIST_HEIGHT + 30, 19>, 2, [skin.work_button]
  547. ;
  548.     mov     ecx, [skin.work_button_text]
  549.     add     ecx, 0x80 shl 24
  550.     mcall   4, <214, LIST_HEIGHT + 37>, , browse_txt
  551.  
  552.  ;; buttons
  553.     mov     eax, 8
  554.     mov     ebx, 4 shl 16 + LIST_WIDTH / 2
  555.     mov     ecx, (10 + 12) shl 16 + LINE_SIZE - 1
  556.     mov     edx, 0x60 shl 24 + 10
  557.     mov     edi, LIST_SIZE
  558.     mov     esi, 0
  559.   @@:
  560.     cmpe    edi, 0, @f
  561.     mcall
  562.  
  563.     cmpe    esi, 0, .doA
  564.  .doB:
  565.     sub     ebx, LIST_WIDTH shl 16
  566.     add     ecx, LINE_SIZE shl 16
  567.  .doA:
  568.     add     ebx, (LIST_WIDTH / 2) shl 16
  569.     sub     ecx, LINE_SIZE shl 16
  570.  
  571.     not     esi
  572.     add     ecx, LINE_SIZE shl 16
  573.     inc     edx
  574.     dec     edi
  575.     jmp     @b
  576.   @@:
  577.  
  578.     mcall   12, 2
  579.     ret
  580.   endp
  581.  
  582.  ;----------------------
  583.  
  584.  proc draw_list
  585.     mcall   13, <3, LIST_WIDTH + 2 + 12>, <9 + 12, 1>, [skin.work_graph]
  586.     mcall     ,                         , <LIST_HEIGHT + 9 + 1 + 12, 1>
  587.     mcall     , <3, 1>, <9 + 12, LIST_HEIGHT + 1>
  588.     mcall     , <3 + LIST_WIDTH + 12 + 1, 1>
  589.     mcall     , <4, LIST_WIDTH>, <10 + 12, LIST_HEIGHT>, 0xFFFfff
  590.  
  591.     mov     esi, 1
  592.     mov     edi, LIST_SIZE / 2 - 1
  593.  .draw_loop:
  594.     mov     edx, 0
  595.     cmpne   [last_x], esi, @f
  596.     cmpne   [last_y], edi, @f
  597.     mov     edx, 1
  598.   @@:
  599.     stdcall draw_item, esi, edi, edx
  600.     dec     esi
  601.     cmpne   esi, -1, @f
  602.     mov     esi, 1
  603.     dec     edi
  604.   @@:
  605.     cmpne   edi, -1, .draw_loop
  606.  
  607.     ret
  608.  endp
  609.  
  610.  ;----------------------
  611.  
  612.  proc draw_item uses edx edi esi, _x, _y, _sel
  613.  ;; get index
  614.     mov     edi, [_y]
  615.     shl     edi, 1
  616.     add     edi, [_x]
  617.     mov     esi, [sb_apps.position]
  618.     shl     esi, 1
  619.     add     edi, esi
  620.  
  621.     cmpge   edi, [list.size], .break
  622.  
  623.  ;; background
  624.     mov     ebx, [_x]
  625.     shl     ebx, 7 + 16
  626.     add     ebx, 4 shl 16 + LIST_WIDTH / 2
  627.  
  628.     imul    ecx, [_y], LINE_SIZE
  629.     shl     ecx, 16
  630.     add     ecx, (10 + 12) shl 16 + LINE_SIZE
  631.  
  632.     mov     edx, 0xFFFfff
  633.     cmpe    [_sel], 0, @f
  634.     mov     edx, 0x94AECE
  635.   @@:
  636.     mcall   13
  637.  
  638.  ;; shadows
  639.     push    ecx
  640.     cmpe    [_sel], 1, .after_shadows
  641.     mov     edx, 0xCCCccc ;[skin.3d]
  642.  
  643.     cmpne   [_x], 0, @f
  644.     imul     ecx, [_y], LINE_SIZE
  645.     shl      ecx, 16
  646.     add      ecx, (10 + 12) shl 16 + LINE_SIZE
  647.     mcall     , <4, 1>
  648.   @@:
  649.  
  650.     cmpne   [_y], 0, @f
  651.     imul     ebx, [_x], LIST_WIDTH / 2
  652.     shl      ebx, 16
  653.     add      ebx, 4 shl 16 + LIST_WIDTH / 2
  654.     mcall     , , <10 + 12, 1>
  655.   @@:
  656.  
  657.  .after_shadows:
  658.     pop     ecx
  659.  
  660.  ;; icon
  661.     and     ebx, 0xFFFF shl 16
  662.     shr     ecx, 16
  663.     add     ecx, ebx
  664.     mov     edx, ecx
  665.     add     edx, 6 shl 16 + (LINE_SIZE - 32) / 2
  666.  
  667.     mov     ebx, edi
  668.     shl     ebx, 2
  669.     mov     ebx, [ebx + list.icon]
  670.     imul    ebx, 32 * 32 * 3
  671.     add     ebx, [img.rgb]
  672.     cmpe    [_sel], 0, .draw_icon
  673.  .selected:
  674.     mov     eax, img.sel
  675.     mov     ecx, 32 * 32
  676.     push    edx
  677.   @@:
  678.     mov     edx, [ebx]
  679.     and     edx, 0xFFFFFF
  680.     cmpne   edx, 0xFFFFFF, .not
  681.     mov     edx, 0x94AECE
  682.  .not:
  683.     mov     [eax], edx
  684.     add     eax, 3
  685.     add     ebx, 3
  686.     dec     ecx
  687.     jnz     @b
  688.     pop     edx
  689.     mov     ebx, img.sel
  690.  
  691.  .draw_icon:
  692.     mcall   7, , <32, 32>
  693.  
  694.  ;; text
  695.     mov     ebx, edx
  696.     add     ebx, (32 + 6) shl 16 + 32 / 2 - 9 / 2
  697.  
  698.     mov     ecx, 0x000000 ; inactive item text
  699.     cmpe    [_sel], 0, @f
  700.     mov     ecx, 0x000000 ; active item text
  701.   @@:
  702.     add     ecx, 0x80 shl 24
  703.  
  704.     mov     edx, edi
  705.     shl     edx, 5
  706.     add     edx, list
  707.  
  708.     mcall   4
  709.  
  710.   .break:
  711.     ret
  712.  endp
  713.  
  714.  ;----------------------
  715.  
  716.  proc section_cb, _file, _sec
  717.  ;; CHECK IF EXISTS
  718.     invoke  libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined
  719.     mcall   70, is_file_exists
  720.     cmpe    ebx, -1, .exit
  721.  
  722.     mov     ebx, [list.size]
  723.     shl     ebx, 5
  724.     add     ebx, list
  725.     stdcall string.compare, [_sec], assoc_ini.sec
  726.     cmpe    eax, 1, @f
  727.     stdcall string.copy, [_sec], ebx
  728.     invoke  libini.get_num, [_file], [_sec], assoc_ini.icon, 0
  729.     mov     ecx, [list.size]
  730.     shl     ecx, 2
  731.     mov     [ecx + list.icon], eax
  732.     inc     [list.size]
  733.     inc     [sb_apps.max_area]
  734.   @@:
  735.     mov     eax, 1
  736.   .exit:
  737.     ret
  738.  endp
  739.  
  740.  ;----------------------
  741.  
  742.  dataend:
  743.  
  744.  ;===============================
  745.  
  746.  skin system_colors
  747.  list rb 32 * 256
  748.   .icon rd 256
  749.   .size rd 1
  750.  img  rd 1
  751.   .rgb rd 1
  752.   .size rd 1
  753.   .buf rb 40
  754.   .sel rb 32 * 32 * 3
  755.  win:
  756.   .x rd 1
  757.   .y rd 1
  758.  win.title rb 256
  759.  param_s rd 1
  760.  param_e rd 1
  761.  param_a rd 1
  762.  undefined rb 1
  763.  buffer rb 2048
  764.  buffer2 rb 2048
  765.  buffer3 rb 2048
  766.  buffer4 rb 4096
  767.  buffer5 rb 4096
  768.  buffer6 rb 2048
  769.  params rb 2048
  770.  _stack rb 2048
  771.  memory:
  772.