Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2004-2007. 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 _fname
  104.     load w dword from _bmp.i.biWidth
  105.     load h dword from _bmp.i.biHeight
  106.   end virtual
  107.   align 4
  108.   label _name
  109.     .width  = w
  110.     .height = h
  111.   dd w,h
  112.   a=54+(w*3+(w mod 4))*(h-1)
  113.   size = $
  114.   repeat h
  115.     repeat w
  116.       virtual at 0
  117.         file _fname
  118.         load r from a+0
  119.         load g from a+1
  120.         load b from a+2
  121.       end virtual
  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,_dtp_sz
  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.     virtual at 0
  177.       file _dtp
  178.       _dtp_sz = $
  179.     end virtual
  180.     dd _dtp_sz
  181.     file _dtp
  182. }
  183.  
  184. macro SKIN_BUTTONS [a]
  185. {
  186.   common
  187.     local btn
  188.     __buttons__:
  189.   forward
  190.     match qq == ww,a
  191.     \{
  192.       btn = 0
  193.       match =close,qq    \\{ btn = 1 \\}
  194.       match =minimize,qq \\{ btn = 2 \\}
  195.       match [q1:q2][q3:q4],ww
  196.       \\{
  197.         if btn <> 0
  198.           dd btn
  199.           dw q1,q2,q3,q4
  200.         end if
  201.       \\}
  202.     \}
  203.   common
  204.     dd 0
  205. }
  206.  
  207. macro SKIN_BITMAPS [a]
  208. {
  209.   common
  210.     local bmp
  211.     __bitmaps__:
  212.   forward
  213.     match qq == ww,a
  214.     \{
  215.       bmp=-1
  216.       match qqq =active,qq   \\{ bmp = 1 \\}
  217.       match qqq =inactive,qq \\{ bmp = 0 \\}
  218.       match =left qqq,qq
  219.       \\{
  220.         if bmp >= 0
  221.           dw 1,bmp
  222.           dd ww
  223.         end if
  224.       \\}
  225.       match =oper qqq,qq
  226.       \\{
  227.         if bmp >= 0
  228.           dw 2,bmp
  229.           dd ww
  230.         end if
  231.       \\}
  232.       match =base qqq,qq
  233.       \\{
  234.         if bmp >= 0
  235.           dw 3,bmp
  236.           dd ww
  237.         end if
  238.       \\}
  239.     \}
  240.   common
  241.     dd 0
  242. }