Subversion Repositories Kolibri OS

Rev

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

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