Subversion Repositories Kolibri OS

Rev

Rev 4789 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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