Subversion Repositories Kolibri OS

Rev

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