Subversion Repositories Kolibri OS

Rev

Rev 5488 | Rev 5721 | 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.   5 shl 16 + 16, (LIST_HEIGHT + 33) shl 16 + 16, 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.to_lower_case, params
  182.     stdcall string.trim_last, params
  183.     stdcall string.trim_first, params
  184.     mov     [param_s], eax
  185.  
  186.  ;; if empty - exit
  187.     cmpe    [eax], byte 0, exit
  188.  
  189.  ;; if folder
  190.     stdcall string.length, [param_s]
  191.     add     eax, [param_s]
  192.     cmpe    [eax - 1], byte '/', open
  193.  
  194.  ;; if dialog
  195.     mov     eax, [param_s]
  196.     mov     [is_openas + 8], eax
  197.     cmpne   [eax], byte '~', @f
  198.     inc     [param_s]
  199.     mov     eax, [param_s]
  200.     mov     [is_openas + 8], eax
  201.     jmp     start_dialog
  202.   @@:
  203.  
  204.  ;; if without '.' - execute
  205.     stdcall string.last_index_of, [param_s], '.', 1
  206.     cmpe    eax, -1, execute
  207.  
  208.  ;; if '.' is part of path - execute
  209.     mov     esi, eax
  210.     stdcall string.last_index_of, [param_s], '/', 1
  211.     cmpg    eax, esi, execute
  212.  
  213.  ;; if ext == "kex" - execute
  214.     add     esi, [param_s]
  215.     mov     [param_e], esi
  216.     cmpe    [esi], dword "kex", execute
  217.  
  218.  open_as:
  219.     invoke  libini.get_str, assoc_ini, assoc_ini.sec, esi, buffer, 2048, undefined
  220.     cmpe    [buffer], byte 0, start_dialog_pre
  221.     cmpne   [buffer], byte "$", @f
  222.     invoke  libini.get_str, assoc_ini, buffer + 1, assoc_ini.exec, buffer, 2048, undefined
  223.     cmpe    [buffer], byte 0, ini_error
  224.   @@:
  225.     mcall   70, is_openas
  226.     jmp     exit
  227.  
  228.  execute:
  229.     mov     eax, [param_s]
  230.     mov     [is_execute + 21], eax
  231.     mcall   70, is_execute
  232.     jmp     exit
  233.  
  234.  open:
  235.     invoke  libini.get_str, assoc_ini, assoc_ini.sec, slash, buffer, 2048, undefined
  236.     cmpe    [buffer], byte 0, ini_error
  237.     mov     eax, [param_s]
  238.     mov     [is_open + 8], eax
  239.     mcall   70, is_open
  240.     jmp     exit
  241.  
  242.  ini_error:
  243.     mcall   70, is_undefined
  244.     jmp     exit
  245.  
  246.  ;----------------------
  247.  
  248.  start_dialog_pre:
  249.     or      [cb_always.flags], ch_flag_en
  250.  
  251.  start_dialog:
  252.     stdcall dll.Load, imports_add
  253.     invoke  opendialog.lib_init
  254.  
  255.     mcall   40, 100111b
  256.  
  257.  ;; get title
  258.     stdcall string.copy, title, win.title
  259.  
  260.  ;; get positions
  261.     mcall   14
  262.     movzx   ebx, ax
  263.     shr     ebx, 1
  264.     shr     eax, 16 + 1
  265.     sub     eax, WIN_WIDTH / 2 - 1
  266.     sub     ebx, WIN_HEIGHT / 2 - 1
  267.     mov     [win.x], eax
  268.     mov     [win.y], ebx
  269.  
  270.  ;; get colors
  271.     mcall   48, 3, skin, 192
  272.  
  273.  ;; get opendialog
  274.     invoke  opendialog.init, opendialog
  275.  
  276.  ;; get pathshow
  277.     mov     eax, [param_s]
  278.     mov     ebx, [skin.win_text]
  279.     mov     [ps_addres.txt], eax
  280.     mov     [ps_addres], ebx
  281.     invoke  pathshow.init, ps_addres
  282.  
  283.  ;; get checkbox
  284.     mov     eax, [skin.gui_face]
  285.     mov     ebx, [skin.gui_fcframe]
  286.     mov     ecx, [skin.win_text]
  287.     mov     [cb_always.color], eax
  288.     mov     [cb_always.border_color], ebx
  289.     mov     [cb_always.text_color], ecx
  290.     invoke  checkbox.init, cb_always
  291.  
  292.  ;; get list
  293.     invoke  libini.for_each_section, assoc_ini, section_cb
  294.     mov     eax, [sb_apps.max_area]
  295.     and     eax, 1b
  296.     shr     [sb_apps.max_area], 1
  297.     add     [sb_apps.max_area], eax
  298.  
  299.     mov     eax, [skin.gui_face]
  300.     mov     ebx, [skin.3d_face]
  301.     mov     [sb_apps.bg_color], eax
  302.     mov     [sb_apps.front_color], ebx
  303.     mov     [sb_apps.line_color], ebx
  304.  
  305.  ;; get icons
  306.     mcall   70, is_openimg_info
  307.     mov     edx, dword [img.buf + 32]
  308.     shl     edx, 4
  309.     stdcall mem.Alloc, edx
  310.     mov     [img.rgb], eax
  311.  
  312.     mov     [is_openimg + 12], edx
  313.     m2m     dword[is_openimg + 16], dword[img.rgb]
  314.     mcall   70, is_openimg
  315.  
  316.     invoke  libimg.decode, dword[img.rgb], ebx, 0
  317.     mov     [img], eax
  318.  
  319.   ;; alpha
  320.     mov     edi, [eax + 8]
  321.     shl     edi, 7
  322.     sub     edi, 4
  323.     mov     eax, [eax + 24]
  324.  .setalpha:
  325.     mov     ebx, [eax + edi]
  326.     shr     ebx, 24
  327.     cmpne   ebx, 0, @f
  328.     mov     ecx, [skin.gui_face]
  329.     mov     [eax + edi], ecx
  330.  @@:
  331.     cmpe    edi, 0, @f
  332.     sub     edi, 4
  333.     jmp     .setalpha
  334.  @@:
  335.  
  336.     invoke  libimg.toRGB, [img], [img.rgb]
  337.     invoke  libimg.destroy, [img]
  338.  
  339.  ;----------------------
  340.  
  341.  update:
  342.     mcall   10
  343.     cmpe    eax, EV_REDRAW, event_redraw
  344.     cmpe    eax, EV_KEY, event_key
  345.     cmpe    eax, EV_BUTTON, event_button
  346.     cmpe    eax, EV_MOUSE, event_mouse
  347.     jmp     update
  348.  
  349.  ;----------------------
  350.  
  351.  event_redraw:
  352.     call    draw_window
  353.     jmp     update
  354.  
  355.  ;----------------------
  356.  
  357.  event_key:
  358.     mcall   2
  359.     cmpe    ah, 27, exit
  360.  
  361. ;    cmpe    ah, 179, .go_right
  362. ;    cmpe    ah, 176, .go_left
  363. ;    cmpe    ah, 178, .go_up
  364. ;    cmpe    ah, 177, .go_down
  365. ;    jmp     update
  366. ;
  367. ; .go_right:
  368. ;    jmp     update
  369. ;
  370. ; .go_left:
  371. ;    jmp     update
  372. ;
  373. ; .go_up:
  374. ;    jmp     update
  375. ;
  376. ; .go_down:
  377. ;    stdcall draw_item, [last_x], [last_y], 0
  378. ;
  379. ;    cmpne   [last_x], -1, @f
  380. ;    mov     [last_x], 0
  381. ;  @@:
  382. ;
  383. ;    cmpne   [last_y], LIST_SIZE / 2 - 1, @f
  384. ;    mov     eax, [sb_apps.position]
  385. ;    add     eax, LIST_SIZE / 2
  386. ;    shl     eax, 1
  387. ;    cmpge   eax, [list.size], .pre
  388. ;    inc     [sb_apps.position]
  389. ;    stdcall draw_list
  390. ;    invoke  scrollbar.draw, sb_apps
  391. ;    jmp     update
  392. ; .pre:
  393. ;    dec     [last_y]
  394. ;  @@:
  395. ;
  396. ;    inc     [last_y]
  397. ;    stdcall draw_item, [last_x], [last_y], 1
  398.     jmp     update
  399.  
  400.  ;----------------------
  401.  
  402.  event_button:
  403.     mcall   17
  404.     cmpe    ah, 1, exit
  405.     cmpe    ah, 2, .opendialog
  406.  
  407.  .fromlist:
  408.     movzx   ebx, ah
  409.     sub     ebx, 10
  410.     mov     ecx, [sb_apps.position]
  411.     shl     ecx, 1
  412.     add     ebx, ecx
  413.     shl     ebx, 5
  414.     add     ebx, list
  415.     cmpe    [ebx], byte 0, update
  416.     mov     [param_a], ebx
  417.     invoke  libini.get_str, assoc_ini, ebx, assoc_ini.exec, buffer, 256, undefined
  418.     cmpe    [buffer], byte 0, ini_error
  419.     mcall   70, is_openas
  420.     mov     edi, 1
  421.  
  422.  .save_assoc:
  423.     mov     eax, [cb_always.flags]
  424.     and     eax, ch_flag_en
  425.     cmpe    eax, 0, exit
  426.  
  427.     cmpe    edi, 0, @f
  428.     stdcall string.copy, app_link, buffer
  429.     stdcall string.concatenate, [param_a], buffer
  430.   @@:
  431.  
  432.     invoke  libini.set_str, assoc_ini, assoc_ini.sec, [param_e], buffer, 33
  433.     jmp     exit
  434.  
  435.  .opendialog:
  436.     invoke  opendialog.start, opendialog
  437.     cmpne   [opendialog.status], 1, update
  438.     mcall   70, is_openas
  439.     mov     edi, 0
  440.     jmp     .save_assoc
  441.  
  442.  ;----------------------
  443.  
  444.  event_mouse:
  445.     invoke  checkbox.mouse, cb_always
  446.     mov     edi, [sb_apps.position]
  447.     invoke  scrollbar.mouse, sb_apps
  448.     sub     edi, [sb_apps.position]
  449.     jz      @f
  450.     call    draw_list
  451.   @@:
  452.  
  453.     mcall   37, 1
  454.     movzx   edi, ax
  455.     shr     eax, 16
  456.     mov     esi, eax
  457.     sub     esi, 4
  458.     sub     edi, 10 + 12
  459.     cmpl    esi, 0, .out
  460.     cmpge   esi, LIST_WIDTH, .out
  461.     cmpl    edi, 0, .out
  462.     cmpge   edi, LIST_HEIGHT, .out
  463.  
  464.     mcall   37, 7
  465.     and     eax, 0xFFFF
  466.     cmpe    eax, 65535, .scroll_up
  467.     cmpe    eax, 0, @f
  468.  
  469.  .scroll_down:
  470.     mov     eax, [sb_apps.position]
  471.     add     eax, LIST_SIZE / 2
  472.     shl     eax, 1
  473.     cmpge   eax, [list.size], @f
  474.     inc     [sb_apps.position]
  475.     stdcall draw_list
  476.     invoke  scrollbar.draw, sb_apps
  477.     jmp     update
  478.  
  479.  .scroll_up:
  480.     cmpe    [sb_apps.position], 0, @f
  481.     dec     [sb_apps.position]
  482.     stdcall draw_list
  483.     invoke  scrollbar.draw, sb_apps
  484.     jmp     update
  485.  
  486.   @@:
  487.  
  488.     mov     eax, esi
  489.     mov     ebx, LIST_WIDTH / 2
  490.     mov     edx, 0
  491.     div     ebx
  492.     mov     esi, eax
  493.  
  494.     mov     eax, edi
  495.     mov     ebx, LINE_SIZE
  496.     mov     edx, 0
  497.     div     ebx
  498.     mov     edi, eax
  499.  
  500.     cmpne   esi, [last_x], .redraw
  501.     cmpne   edi, [last_y], .redraw
  502.     jmp     @f
  503.  
  504.  .redraw:
  505.     stdcall draw_item, [last_x], [last_y], 0
  506.     mov     [last_x], esi
  507.     mov     [last_y], edi
  508.     stdcall draw_item, esi, edi, 1
  509.     jmp     @f
  510.  
  511.  .out:
  512.     cmpe    [last_x], -1, @f
  513.     stdcall draw_item, [last_x], [last_y], 0
  514.     mov     [last_x], -1
  515.     mov     [last_y], -1
  516.   @@:
  517.  
  518.     jmp     update
  519.  
  520.  ;----------------------
  521.  
  522.  exit:
  523.     mcall   -1
  524.  
  525.  ;----------------------
  526.  
  527.  proc draw_window
  528.     mcall   12, 1
  529.  
  530.     mov     edx, [skin.win_face]
  531.     or      edx, 0x34 shl 24
  532.     mcall   0, <[win.x], WIN_WIDTH>, <[win.y], WIN_HEIGHT>, , , win.title
  533.     stdcall draw_list
  534.     invoke  scrollbar.draw, sb_apps
  535.     invoke  pathshow.draw, ps_addres
  536.     invoke  checkbox.draw, cb_always
  537.  
  538.     mcall   13, <207, 66>, <LIST_HEIGHT + 29, 22>, [skin.btn_frame]
  539.     mcall   8, <208, 63>, <LIST_HEIGHT + 30, 19>, 2, [skin.btn_face]
  540. ;
  541.     mov     ecx, [skin.btn_text]
  542.     add     ecx, 0x80 shl 24
  543.     mcall   4, <214, LIST_HEIGHT + 37>, , browse_txt
  544.  
  545.  ;; buttons
  546.     mov     eax, 8
  547.     mov     ebx, 4 shl 16 + LIST_WIDTH / 2
  548.     mov     ecx, (10 + 12) shl 16 + LINE_SIZE - 1
  549.     mov     edx, 0x60 shl 24 + 10
  550.     mov     edi, LIST_SIZE
  551.     mov     esi, 0
  552.   @@:
  553.     cmpe    edi, 0, @f
  554.     mcall
  555.  
  556.     cmpe    esi, 0, .doA
  557.  .doB:
  558.     sub     ebx, LIST_WIDTH shl 16
  559.     add     ecx, LINE_SIZE shl 16
  560.  .doA:
  561.     add     ebx, (LIST_WIDTH / 2) shl 16
  562.     sub     ecx, LINE_SIZE shl 16
  563.  
  564.     not     esi
  565.     add     ecx, LINE_SIZE shl 16
  566.     inc     edx
  567.     dec     edi
  568.     jmp     @b
  569.   @@:
  570.  
  571.     mcall   12, 2
  572.     ret
  573.   endp
  574.  
  575.  ;----------------------
  576.  
  577.  proc draw_list
  578.     mcall   13, <3, LIST_WIDTH + 2 + 12>, <9 + 12, 1>, [skin.gui_fcframe]
  579.     mcall     ,                         , <LIST_HEIGHT + 9 + 1 + 12, 1>
  580.     mcall     , <3, 1>, <9 + 12, LIST_HEIGHT + 1>
  581.     mcall     , <3 + LIST_WIDTH + 12 + 1, 1>
  582.     mcall     , <4, LIST_WIDTH>, <10 + 12, LIST_HEIGHT>, [skin.gui_face]
  583.  
  584.     mov     esi, 1
  585.     mov     edi, LIST_SIZE / 2 - 1
  586.  .draw_loop:
  587.     mov     edx, 0
  588.     cmpne   [last_x], esi, @f
  589.     cmpne   [last_y], edi, @f
  590.     mov     edx, 1
  591.   @@:
  592.     stdcall draw_item, esi, edi, edx
  593.     dec     esi
  594.     cmpne   esi, -1, @f
  595.     mov     esi, 1
  596.     dec     edi
  597.   @@:
  598.     cmpne   edi, -1, .draw_loop
  599.  
  600.     ret
  601.  endp
  602.  
  603.  ;----------------------
  604.  
  605.  proc draw_item uses edx edi esi, _x, _y, _sel
  606.  ;; get index
  607.     mov     edi, [_y]
  608.     shl     edi, 1
  609.     add     edi, [_x]
  610.     mov     esi, [sb_apps.position]
  611.     shl     esi, 1
  612.     add     edi, esi
  613.  
  614.     cmpge   edi, [list.size], .break
  615.  
  616.  ;; background
  617.     mov     ebx, [_x]
  618.     shl     ebx, 7 + 16
  619.     add     ebx, 4 shl 16 + LIST_WIDTH / 2
  620.  
  621.     imul    ecx, [_y], LINE_SIZE
  622.     shl     ecx, 16
  623.     add     ecx, (10 + 12) shl 16 + LINE_SIZE
  624.  
  625.     mov     edx, [skin.gui_face]
  626.     cmpe    [_sel], 0, @f
  627.     mov     edx, [skin.gui_fcframe]
  628.   @@:
  629.     mcall   13
  630.  
  631.  ;; shadows
  632.     push    ecx
  633.     cmpe    [_sel], 1, .after_shadows
  634.     mov     edx, [skin.3d_face]
  635.  
  636.     cmpne   [_x], 0, @f
  637.     imul     ecx, [_y], LINE_SIZE
  638.     shl      ecx, 16
  639.     add      ecx, (10 + 12) shl 16 + LINE_SIZE
  640.     mcall     , <4, 1>
  641.   @@:
  642.  
  643.     cmpne   [_y], 0, @f
  644.     imul     ebx, [_x], LIST_WIDTH / 2
  645.     shl      ebx, 16
  646.     add      ebx, 4 shl 16 + LIST_WIDTH / 2
  647.     mcall     , , <10 + 12, 1>
  648.   @@:
  649.  
  650.  .after_shadows:
  651.     pop     ecx
  652.  
  653.  ;; icon
  654.     and     ebx, 0xFFFF shl 16
  655.     shr     ecx, 16
  656.     add     ecx, ebx
  657.     mov     edx, ecx
  658.     add     edx, 6 shl 16 + (LINE_SIZE - 32) / 2
  659.  
  660.     mov     ebx, edi
  661.     shl     ebx, 2
  662.     mov     ebx, [ebx + list.icon]
  663.     imul    ebx, 32 * 32 * 3
  664.     add     ebx, [img.rgb]
  665.     cmpe    [_sel], 0, .draw_icon
  666.  .selected:
  667.     mov     eax, img.sel
  668.     mov     ecx, 32 * 32
  669.     push    edx
  670.   @@:
  671.     mov     edx, [ebx]
  672.     and     edx, 0xFFFFFF
  673.     cmpne   edx, [skin.gui_face], .not
  674.     mov     edx, [skin.gui_fcframe]
  675.  .not:
  676.     mov     [eax], edx
  677.     add     eax, 3
  678.     add     ebx, 3
  679.     dec     ecx
  680.     jnz     @b
  681.     pop     edx
  682.     mov     ebx, img.sel
  683.  
  684.  .draw_icon:
  685.     mcall   7, , <32, 32>
  686.  
  687.  ;; text
  688.     mov     ebx, edx
  689.     add     ebx, (32 + 6) shl 16 + 32 / 2 - 9 / 2
  690.  
  691.     mov     ecx, [skin.gui_text]
  692.     cmpe    [_sel], 0, @f
  693.     mov     ecx, [skin.gui_fctext]
  694.   @@:
  695.     add     ecx, 0x80 shl 24
  696.  
  697.     mov     edx, edi
  698.     shl     edx, 5
  699.     add     edx, list
  700.  
  701.     mcall   4
  702.  
  703.   .break:
  704.     ret
  705.  endp
  706.  
  707.  ;----------------------
  708.  
  709.  proc section_cb, _file, _sec
  710.     mov     ebx, [list.size]
  711.     shl     ebx, 5
  712.     add     ebx, list
  713.     stdcall string.compare, [_sec], assoc_ini.sec
  714.     cmpe    eax, 1, @f
  715.     stdcall string.copy, [_sec], ebx
  716.     invoke  libini.get_num, [_file], [_sec], assoc_ini.icon, 0
  717.     mov     ecx, [list.size]
  718.     shl     ecx, 2
  719.     mov     [ecx + list.icon], eax
  720.     inc     [list.size]
  721.     inc     [sb_apps.max_area]
  722.   @@:
  723.     mov     eax, 1
  724.     ret
  725.  endp
  726.  
  727.  ;----------------------
  728.  
  729.  dataend:
  730.  
  731.  ;===============================
  732.  
  733.  skin sys_colors_new
  734.  list rb 32 * 256
  735.   .icon rd 256
  736.   .size rd 1
  737.  img  rd 1
  738.   .rgb rd 1
  739.   .size rd 1
  740.   .buf rb 40
  741.   .sel rb 32 * 32 * 3
  742.  win:
  743.   .x rd 1
  744.   .y rd 1
  745.  win.title rb 256
  746.  param_s rd 1
  747.  param_e rd 1
  748.  param_a rd 1
  749.  undefined rb 1
  750.  buffer rb 2048
  751.  buffer2 rb 2048
  752.  buffer3 rb 2048
  753.  buffer4 rb 4096
  754.  buffer5 rb 4096
  755.  params rb 2048
  756.  _stack rb 2048
  757.  memory: