Subversion Repositories Kolibri OS

Rev

Rev 5903 | Rev 5906 | 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,  13, list_item_activate
  369.     cmpe    ah, 179, .go_right
  370.     cmpe    ah, 176, .go_left
  371.     cmpe    ah, 178, .go_up
  372.     cmpe    ah, 177, .go_down
  373.     jmp     update
  374.  
  375.  .go_right:
  376.     mov     esi, 1
  377.     jmp     .go_anyway
  378.  
  379.  .go_left:
  380.     mov     esi, -1
  381.     jmp     .go_anyway
  382.  
  383.  .go_up:
  384.     mov     esi, -2
  385.     jmp     .go_anyway
  386.  
  387.  .go_down:
  388.     mov     esi, 2
  389.  
  390.  .go_anyway:
  391. ;; HIDE OLD SELECTION
  392.     stdcall draw_item, [last_x], [last_y], 0
  393.  
  394. ;; [X, Y] -> INDEX
  395.     mov     eax, [last_y]
  396.     shl     eax, 1
  397.     add     eax, [last_x]
  398.     mov     ebx, [sb_apps.position]
  399.     shl     ebx, 1
  400.     add     eax, ebx
  401.  
  402. ;; CHANGE INDEX
  403.     add     eax, esi
  404.  
  405.     cmpl    eax, [list.size], @f
  406.     mov     eax, [list.size]
  407.     dec     eax
  408.   @@:
  409.  
  410.     cmpge   eax, 0, @f
  411.     mov     eax, 0
  412.   @@:
  413.  
  414. ;; INDEX -> [X, Y]
  415.     sub     eax, ebx
  416.     mov     ebx, eax
  417.     and     ebx, 1b
  418.     mov     [last_x], ebx
  419.     shr     eax, 1
  420.     mov     [last_y], eax
  421.  
  422.     cmpl    [last_y], 0xFFFF, @f
  423.     mov     [last_y], 0
  424.     dec     [sb_apps.position]
  425.     jmp     .full_redraw
  426.   @@:
  427.  
  428.     cmpl    [last_y], LIST_SIZE / 2, @f
  429.     mov     [last_y], LIST_SIZE / 2 - 1
  430.     inc     [sb_apps.position]
  431.     jmp     .full_redraw
  432.   @@:
  433.  
  434. ;; DRAW NEW SELECTION
  435.  .partly_redraw:
  436.     stdcall draw_item, [last_x], [last_y], 1
  437.     jmp     update
  438.  
  439.  .full_redraw:
  440.     cmpge   [sb_apps.position], 0, @f
  441.     mov     [sb_apps.position], 0
  442.   @@:
  443.  
  444.     stdcall draw_list
  445.     invoke  scrollbar.draw, sb_apps
  446.     jmp     update
  447.  
  448.  ;----------------------
  449.  
  450.  event_button:
  451.     mcall   17
  452.     cmpe    ah, 1, exit
  453.     cmpe    ah, 2, .opendialog
  454.     jmp     list_item_activate
  455.  
  456.  .opendialog:
  457.     invoke  opendialog.start, opendialog
  458.     cmpne   [opendialog.status], 1, update
  459.     mcall   70, is_openas
  460.  
  461.     mov     edi, 0
  462.     jmp     save_assoc
  463.  
  464.  ;----------------------
  465.  
  466.  list_item_activate:
  467.     mov     eax, [last_y]
  468.     shl     eax, 1
  469.     add     eax, [last_x]
  470.     mov     ebx, [sb_apps.position]
  471.     shl     ebx, 1
  472.     add     eax, ebx
  473.     shl     eax, 5
  474.     add     eax, list
  475.     cmpe    byte [eax], 0, update
  476.     mov     [param_a], eax
  477.     invoke  libini.get_str, assoc_ini, eax, assoc_ini.exec, buffer, 256, undefined
  478.     cmpe    byte [buffer], 0, ini_error
  479.     mcall   70, is_openas
  480.  
  481.     mov     edi, 1
  482.     jmp     save_assoc
  483.  
  484.  ;----------------------
  485.  
  486.  save_assoc:
  487.     mov     eax, [cb_always.flags]
  488.     and     eax, ch_flag_en
  489.     cmpe    eax, 0, exit
  490.  
  491.     cmpe    edi, 0, @f
  492.     stdcall string.copy, app_link, buffer
  493.     stdcall string.concatenate, [param_a], buffer
  494.   @@:
  495.  
  496.     invoke  libini.set_str, assoc_ini, assoc_ini.sec, [param_e], buffer, 33
  497.     jmp     exit
  498.  
  499.  ;----------------------
  500.  
  501.  event_mouse:
  502.     invoke  checkbox.mouse, cb_always
  503.     mov     edi, [sb_apps.position]
  504.     invoke  scrollbar.mouse, sb_apps
  505.     sub     edi, [sb_apps.position]
  506.     jz      @f
  507.     call    draw_list
  508.   @@:
  509.  
  510.     mcall   37, 1
  511.     movzx   edi, ax
  512.     shr     eax, 16
  513.     mov     esi, eax
  514.     sub     esi, 4
  515.     sub     edi, 10 + 12
  516.     cmpl    esi, 0, .out
  517.     cmpge   esi, LIST_WIDTH, .out
  518.     cmpl    edi, 0, .out
  519.     cmpge   edi, LIST_HEIGHT, .out
  520.  
  521.     mcall   37, 7
  522.     and     eax, 0xFFFF
  523.     cmpe    eax, 65535, .scroll_up
  524.     cmpe    eax, 0, @f
  525.  
  526.  .scroll_down:
  527.     mov     eax, [sb_apps.position]
  528.     add     eax, LIST_SIZE / 2
  529.     shl     eax, 1
  530.     cmpge   eax, [list.size], @f
  531.     inc     [sb_apps.position]
  532.     stdcall draw_list
  533.     invoke  scrollbar.draw, sb_apps
  534.     jmp     update
  535.  
  536.  .scroll_up:
  537.     cmpe    [sb_apps.position], 0, @f
  538.     dec     [sb_apps.position]
  539.     stdcall draw_list
  540.     invoke  scrollbar.draw, sb_apps
  541.     jmp     update
  542.  
  543.   @@:
  544.  
  545.     mov     eax, esi
  546.     mov     ebx, LIST_WIDTH / 2
  547.     mov     edx, 0
  548.     div     ebx
  549.     mov     esi, eax
  550.  
  551.     mov     eax, edi
  552.     mov     ebx, LINE_SIZE
  553.     mov     edx, 0
  554.     div     ebx
  555.     mov     edi, eax
  556.  
  557.     cmpne   esi, [last_x], .redraw
  558.     cmpne   edi, [last_y], .redraw
  559.     jmp     @f
  560.  
  561.  .redraw:
  562.     stdcall draw_item, [last_x], [last_y], 0
  563.     mov     [last_x], esi
  564.     mov     [last_y], edi
  565.     stdcall draw_item, esi, edi, 1
  566.     jmp     @f
  567.  
  568.  .out:
  569.     cmpe    [last_x], -1, @f
  570.     stdcall draw_item, [last_x], [last_y], 0
  571.     mov     [last_x], -1
  572.     mov     [last_y], -1
  573.   @@:
  574.  
  575.     jmp     update
  576.  
  577.  ;----------------------
  578.  
  579.  exit:
  580.     mcall   -1
  581.  
  582.  ;----------------------
  583.  
  584.  proc draw_window
  585.     mcall   12, 1
  586.  
  587.     mov     edx, [skin.work]
  588.     or      edx, 0x34 shl 24
  589.     mcall   0, <[win.x], WIN_WIDTH>, <[win.y], WIN_HEIGHT>, , , win.title
  590.     stdcall draw_list
  591.     invoke  scrollbar.draw, sb_apps
  592.     invoke  pathshow.draw, ps_addres
  593.     invoke  checkbox.draw, cb_always
  594.  
  595.     mcall   13, <207, 66>, <LIST_HEIGHT + 29, 22>, [skin.work_graph]
  596.     mcall   8, <208, 63>, <LIST_HEIGHT + 30, 19>, 2, [skin.work_button]
  597. ;
  598.     mov     ecx, [skin.work_button_text]
  599.     add     ecx, 0x80 shl 24
  600.     mcall   4, <214, LIST_HEIGHT + 37>, , browse_txt
  601.  
  602.  ;; buttons
  603.     mov     eax, 8
  604.     mov     ebx, 4 shl 16 + LIST_WIDTH / 2
  605.     mov     ecx, (10 + 12) shl 16 + LINE_SIZE - 1
  606.     mov     edx, 0x60 shl 24 + 10
  607.     mov     edi, LIST_SIZE
  608.     mov     esi, 0
  609.   @@:
  610.     cmpe    edi, 0, @f
  611.     mcall
  612.  
  613.     cmpe    esi, 0, .doA
  614.  .doB:
  615.     sub     ebx, LIST_WIDTH shl 16
  616.     add     ecx, LINE_SIZE shl 16
  617.  .doA:
  618.     add     ebx, (LIST_WIDTH / 2) shl 16
  619.     sub     ecx, LINE_SIZE shl 16
  620.  
  621.     not     esi
  622.     add     ecx, LINE_SIZE shl 16
  623.     inc     edx
  624.     dec     edi
  625.     jmp     @b
  626.   @@:
  627.  
  628.     mcall   12, 2
  629.     ret
  630.   endp
  631.  
  632.  ;----------------------
  633.  
  634.  proc draw_list
  635.     mcall   13, <3, LIST_WIDTH + 2 + 12>, <9 + 12, 1>, [skin.work_graph]
  636.     mcall     ,                         , <LIST_HEIGHT + 9 + 1 + 12, 1>
  637.     mcall     , <3, 1>, <9 + 12, LIST_HEIGHT + 1>
  638.     mcall     , <3 + LIST_WIDTH + 12 + 1, 1>
  639.     mcall     , <4, LIST_WIDTH>, <10 + 12, LIST_HEIGHT>, 0xFFFfff
  640.  
  641.     mov     esi, 1
  642.     mov     edi, LIST_SIZE / 2 - 1
  643.  .draw_loop:
  644.     mov     edx, 0
  645.     cmpne   [last_x], esi, @f
  646.     cmpne   [last_y], edi, @f
  647.     mov     edx, 1
  648.   @@:
  649.     stdcall draw_item, esi, edi, edx
  650.     dec     esi
  651.     cmpne   esi, -1, @f
  652.     mov     esi, 1
  653.     dec     edi
  654.   @@:
  655.     cmpne   edi, -1, .draw_loop
  656.  
  657.     ret
  658.  endp
  659.  
  660.  ;----------------------
  661.  
  662.  proc draw_item uses edx edi esi, _x, _y, _sel
  663.  ;; get index
  664.     mov     edi, [_y]
  665.     shl     edi, 1
  666.     add     edi, [_x]
  667.     mov     esi, [sb_apps.position]
  668.     shl     esi, 1
  669.     add     edi, esi
  670.  
  671.     cmpge   edi, [list.size], .break
  672.  
  673.  ;; background
  674.     mov     ebx, [_x]
  675.     shl     ebx, 7 + 16
  676.     add     ebx, 4 shl 16 + LIST_WIDTH / 2
  677.  
  678.     imul    ecx, [_y], LINE_SIZE
  679.     shl     ecx, 16
  680.     add     ecx, (10 + 12) shl 16 + LINE_SIZE
  681.  
  682.     mov     edx, 0xFFFfff
  683.     cmpe    [_sel], 0, @f
  684.     mov     edx, 0x94AECE
  685.   @@:
  686.     mcall   13
  687.  
  688.  ;; shadows
  689.     push    ecx
  690.     cmpe    [_sel], 1, .after_shadows
  691.     mov     edx, 0xCCCccc ;[skin.3d]
  692.  
  693.     cmpne   [_x], 0, @f
  694.     imul     ecx, [_y], LINE_SIZE
  695.     shl      ecx, 16
  696.     add      ecx, (10 + 12) shl 16 + LINE_SIZE
  697.     mcall     , <4, 1>
  698.   @@:
  699.  
  700.     cmpne   [_y], 0, @f
  701.     imul     ebx, [_x], LIST_WIDTH / 2
  702.     shl      ebx, 16
  703.     add      ebx, 4 shl 16 + LIST_WIDTH / 2
  704.     mcall     , , <10 + 12, 1>
  705.   @@:
  706.  
  707.  .after_shadows:
  708.     pop     ecx
  709.  
  710.  ;; icon
  711.     and     ebx, 0xFFFF shl 16
  712.     shr     ecx, 16
  713.     add     ecx, ebx
  714.     mov     edx, ecx
  715.     add     edx, 6 shl 16 + (LINE_SIZE - 32) / 2
  716.  
  717.     mov     ebx, edi
  718.     shl     ebx, 2
  719.     mov     ebx, [ebx + list.icon]
  720.     imul    ebx, 32 * 32 * 3
  721.     add     ebx, [img.rgb]
  722.     cmpe    [_sel], 0, .draw_icon
  723.  .selected:
  724.     mov     eax, img.sel
  725.     mov     ecx, 32 * 32
  726.     push    edx
  727.   @@:
  728.     mov     edx, [ebx]
  729.     and     edx, 0xFFFFFF
  730.     cmpne   edx, 0xFFFFFF, .not
  731.     mov     edx, 0x94AECE
  732.  .not:
  733.     mov     [eax], edx
  734.     add     eax, 3
  735.     add     ebx, 3
  736.     dec     ecx
  737.     jnz     @b
  738.     pop     edx
  739.     mov     ebx, img.sel
  740.  
  741.  .draw_icon:
  742.     mcall   7, , <32, 32>
  743.  
  744.  ;; text
  745.     mov     ebx, edx
  746.     add     ebx, (32 + 6) shl 16 + 32 / 2 - 9 / 2
  747.  
  748.     mov     ecx, 0x000000 ; inactive item text
  749.     cmpe    [_sel], 0, @f
  750.     mov     ecx, 0x000000 ; active item text
  751.   @@:
  752.     add     ecx, 0x80 shl 24
  753.  
  754.     mov     edx, edi
  755.     shl     edx, 5
  756.     add     edx, list
  757.  
  758.     mcall   4
  759.  
  760.   .break:
  761.     ret
  762.  endp
  763.  
  764.  ;----------------------
  765.  
  766.  proc section_cb, _file, _sec
  767.  ;; CHECK IF EXISTS
  768.     invoke  libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined
  769.     mcall   70, is_file_exists
  770.     cmpe    ebx, -1, .exit
  771.  
  772.     mov     ebx, [list.size]
  773.     shl     ebx, 5
  774.     add     ebx, list
  775.     stdcall string.compare, [_sec], assoc_ini.sec
  776.     cmpe    eax, 1, @f
  777.     stdcall string.copy, [_sec], ebx
  778.     invoke  libini.get_num, [_file], [_sec], assoc_ini.icon, 0
  779.     mov     ecx, [list.size]
  780.     shl     ecx, 2
  781.     mov     [ecx + list.icon], eax
  782.     inc     [list.size]
  783.     inc     [sb_apps.max_area]
  784.   @@:
  785.     mov     eax, 1
  786.   .exit:
  787.     ret
  788.  endp
  789.  
  790.  ;----------------------
  791.  
  792.  dataend:
  793.  
  794.  ;===============================
  795.  
  796.  skin system_colors
  797.  list rb 32 * 256
  798.   .icon rd 256
  799.   .size rd 1
  800.  img  rd 1
  801.   .rgb rd 1
  802.   .size rd 1
  803.   .buf rb 40
  804.   .sel rb 32 * 32 * 3
  805.  win:
  806.   .x rd 1
  807.   .y rd 1
  808.  win.title rb 256
  809.  param_s rd 1
  810.  param_e rd 1
  811.  param_a rd 1
  812.  undefined rb 1
  813.  buffer rb 2048
  814.  buffer2 rb 2048
  815.  buffer3 rb 2048
  816.  buffer4 rb 4096
  817.  buffer5 rb 4096
  818.  buffer6 rb 2048
  819.  params rb 2048
  820.  _stack rb 2048
  821.  memory:
  822.