Subversion Repositories Kolibri OS

Rev

Rev 4789 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
  4. ;; Distributed under terms of the GNU General Public License    ;;
  5. ;;                                                              ;;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7.  
  8. ;============================================================================
  9. ; This file should be used to generate skins of new standard
  10. ;============================================================================
  11. ; skin file structure:
  12. ;----------------------------------------------------------------------------
  13. ;  header:
  14. ;   dd 'SKIN'
  15. ;   dd = version (1 for now)
  16. ;   dd @ params
  17. ;   dd @ buttons
  18. ;   dd @ bitmaps
  19. ; ...
  20. ;----------------------------------------------------------------------------
  21. ; NOTE: order of sections listed below is insignificant
  22. ;       since they're identified by pointer in above header
  23. ;----------------------------------------------------------------------------
  24. ; ...
  25. ;  params:
  26. ;   dd = skin height
  27. ;   dw = right margin
  28. ;   dw = left margin
  29. ;   dw = bottom margin
  30. ;   dw = top margin
  31. ;   dd = inner line color
  32. ;   dd = outer line color
  33. ;   dd = frame color
  34. ;   dd = dtp file size
  35. ;   ?? = dtp file itself
  36. ; ...
  37. ;----------------------------------------------------------------------------
  38. ; ...
  39. ;  buttons:
  40. ;   dd = button type (1 = close, 2 = minimize)
  41. ;   dw = left button coord (could be negative)
  42. ;   dw = top button coord (could be negative)
  43. ;   dw = button width
  44. ;   dw = button height
  45. ;   ... etc for all buttons
  46. ;   dd = 0 (end of buttons list)
  47. ; ...
  48. ;----------------------------------------------------------------------------
  49. ; ...
  50. ;  bitmaps:
  51. ;   dw = bitmap kind (1 = left, 2 = oper, 3 = base)
  52. ;   dw = bitmap type (1 = active, 0 = inactive)
  53. ;   dd @ bitmap
  54. ;   ... etc for all bitmaps
  55. ;   dd 0 (end of bitmaps list)
  56. ; ...
  57. ;----------------------------------------------------------------------------
  58. ; ...
  59. ;  bitmap:
  60. ;   dd = bitmap width
  61. ;   dd = bitmap height
  62. ;   ?? = raw bitmap data
  63. ;   ... etc for all bitmaps
  64. ; ...
  65. ;============================================================================
  66.  
  67. dd 'SKIN',1,__params__,__buttons__,__bitmaps__
  68.  
  69. struc BITMAPFILEHEADER {
  70.   .bfType      dw ? ; WORD
  71.   .bfSize      dd ? ; DWORD
  72.   .bfReserved1 dw ? ; WORD
  73.   .bfReserved2 dw ? ; WORD
  74.   .bfOffBits   dd ? ; DWORD
  75. }
  76.  
  77. struc BITMAPINFOHEADER {
  78.   .biSize          dd ? ; DWORD
  79.   .biWidth         dd ? ; LONG
  80.   .biHeight        dd ? ; LONG
  81.   .biPlanes        dw ? ; WORD
  82.   .biBitCount      dw ? ; WORD
  83.   .biCompression   dd ? ; DWORD
  84.   .biSizeImage     dd ? ; DWORD
  85.   .biXPelsPerMeter dd ? ; LONG
  86.   .biYPelsPerMeter dd ? ; LONG
  87.   .biClrUsed       dd ? ; DWORD
  88.   .biClrImportant  dd ? ; DWORD
  89. }
  90.  
  91. struc _bmp {
  92.   .h BITMAPFILEHEADER
  93.   .i BITMAPINFOHEADER
  94. }
  95. virtual at 0
  96.   _bmp _bmp
  97. end virtual
  98.  
  99. macro BITMAP _name*,_fname*
  100. {
  101.   local w,h,a,r,g,b
  102.   virtual at 0
  103.     _file equ _#_name
  104.     _file::
  105.     file _fname
  106.   end virtual
  107.   load w dword from _file:_bmp.i.biWidth
  108.   load h dword from _file:_bmp.i.biHeight
  109.   load hsize dword from _file:_bmp.h.bfOffBits
  110.   align 4
  111.   label _name
  112.     .width  = w
  113.     .height = h
  114.   dd w,h
  115.   a=hsize+(w*3+(w mod 4))*(h-1)
  116.   size = $
  117.   repeat h
  118.     repeat w
  119.       load r from _file:a+0
  120.       load g from _file:a+1
  121.       load b from _file:a+2
  122.       db r,g,b
  123.       a=a+3
  124.     end repeat
  125.     a=a-w*3*2-(w mod 4)
  126.   end repeat
  127. }
  128.  
  129. macro define_colors name,[col,val]
  130. {
  131.   common
  132.     local a,b,c
  133.   forward
  134.     match =binner,col \{ a = val \}
  135.     match =bouter,col \{ b = val \}
  136.     match =bframe,col \{ c = val \}
  137.   common
  138.     name equ a,b,c
  139. }
  140.  
  141. macro SKIN_PARAMS [a]
  142. {
  143.   common
  144.     local _height,_margins,_colors,_colors_1,_dtp
  145.     __params__:
  146.   forward
  147.     match qq == ww,a
  148.     \{
  149.       match =height,qq \\{ _height = ww \\}
  150.       match =margins,qq \\{
  151.         match [q1:q2:q3:q4],ww
  152.         \\\{
  153.           _margins equ q3,q1,q4,q2
  154.         \\\}
  155.       \\}
  156.       match =colors =active,qq
  157.       \\{
  158.         match [q10==q11:q20==q21:q30==q31],ww
  159.         \\\{
  160.           define_colors _colors,q10,q11,q20,q21,q30,q31
  161.         \\\}
  162.       \\}
  163.       match =colors =inactive,qq
  164.       \\{
  165.         match [q10==q11:q20==q21:q30==q31],ww
  166.         \\\{
  167.           define_colors _colors_1,q10,q11,q20,q21,q30,q31
  168.         \\\}
  169.       \\}
  170.       match =dtp,qq \\{ _dtp equ ww \\}
  171.     \}
  172.   common
  173.     dd _height
  174.     dw _margins
  175.     dd _colors,_colors_1
  176.     dd @f - $ - 4
  177.     file _dtp
  178.     @@:
  179. }
  180.  
  181. macro SKIN_BUTTONS [a]
  182. {
  183.   common
  184.     local btn
  185.     __buttons__:
  186.   forward
  187.     match qq == ww,a
  188.     \{
  189.       btn = 0
  190.       match =close,qq    \\{ btn = 1 \\}
  191.       match =minimize,qq \\{ btn = 2 \\}
  192.       match [q1:q2][q3:q4],ww
  193.       \\{
  194.         if btn <> 0
  195.           dd btn
  196.           dw q1,q2,q3,q4
  197.         end if
  198.       \\}
  199.     \}
  200.   common
  201.     dd 0
  202. }
  203.  
  204. macro SKIN_BITMAPS [a]
  205. {
  206.   common
  207.     local bmp
  208.     __bitmaps__:
  209.   forward
  210.     match qq == ww,a
  211.     \{
  212.       bmp=-1
  213.       match qqq =active,qq   \\{ bmp = 1 \\}
  214.       match qqq =inactive,qq \\{ bmp = 0 \\}
  215.       match =left qqq,qq
  216.       \\{
  217.         if bmp >= 0
  218.           dw 1,bmp
  219.           dd ww
  220.         end if
  221.       \\}
  222.       match =oper qqq,qq
  223.       \\{
  224.         if bmp >= 0
  225.           dw 2,bmp
  226.           dd ww
  227.         end if
  228.       \\}
  229.       match =base qqq,qq
  230.       \\{
  231.         if bmp >= 0
  232.           dw 3,bmp
  233.           dd ww
  234.         end if
  235.       \\}
  236.     \}
  237.   common
  238.     dd 0
  239. }
  240.